Private class object initialization

Hi,

I have the following header:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 
#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?

Thank you,
Scott
Topic archived. No new replies allowed.