A problem!
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
class A{ public: int m_var; A(){ m_var=0; }; } class B{ public: A m_var2; //I want to know where the class A's struct function can be execute? thanks! }
The constructor is called before B's constructor, so if it took an argument, you could not do this: class A{ public: A(int n){ m_n = n;}; etc..... class B{ public: A m_var2; A() { m_var2(7); } You'd need to do this in your cpp file: A::A() : m_var2(7) { } Christian I have come to clean zee pooollll. - Michael Martin Dec 30, 2001 Picture the daffodil. And while you do that, I'll be over here going through your stuff.