Answers for "how initilaize deffult value to c++ class"

C++
0

how initilaize deffult value to c++ class

class X {
  int i = 4;
  int j {5};
public:
  X(int a) : i{a} {}  //initializes with a and 5
  X() = default;      //initializes with 4 and 5
};
Posted by: Guest on June-22-2020

Browse Popular Code Answers by Language