#ifndef hdr_h
#define hdr_h
class MyClass{
public:
MyClass( int argToPass );
~MyClass();
private:
PrvClass pClass; //this takes an argument in the constructor
};
#endif
and here is the constructor in MyClass.cpp
1 2 3 4 5 6
MyClass::MyClass(int argToPass ){
//how do I pass argTo Pass to the private member object constructor?
}
The problem I am having is the following:
The PrvClass class constructor requires an argument for construction. However, since I declare the object in the header file, how can I pass an argument from the MyClass constructor to the PrvClass constructor if the PrvClass is declared in the header?