Answers for "formats of constructor in c++"

C++
3

how to initialize the object in constructor in c++

BigMommaClass {
    BigMommaClass(int, int);

private:
    ThingOne thingOne;
    ThingTwo thingTwo;
};

BigMommaClass::BigMommaClass(int numba1, int numba2): thingOne(numba1 + numba2), thingTwo(numba1, numba2) {
// Code here
}
Posted by: Guest on November-01-2020
0

formats of constructor in c++

Line::Line( double len): length(len) {
   cout << "Object is being created, length = " << len << endl;
}
Posted by: Guest on November-12-2020

Browse Popular Code Answers by Language