El Zorko
-1
Q:

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
}
3

New to Communities?

Join the community