I have a class that has a static const member variable in it. The variable is anouther class. I know you can't initialize it inside the class so how would I go about doing that?
I have a class that has a static const member variable in it. The variable is anouther class. I know you can't initialize it inside the class so how would I go about doing that?
Posting code helps.
[edit]Code:class T { static const double pi; }; const double T::pi = 4.0 * std::atan(1.0);Code:class T { int i; public: T(int i_ = 0) : i(i_) {} }; class U { static const T t; }; const T U::t = 0;
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Yup ok that works perfectly. Thanks.