PRODUCT : C++ NUMBER : 651 VERSION : All OS : PC DOS DATE : October 22, 1993 PAGE : 1/1 TITLE : Initializing Static Class Members of Type Class /* IMPORTANT! When testing static member initialization, you must declare an instance of the class in a main function;otherwise, the linker has no reference which it must try to resolve, and the undefined symbol error will not be seen--thus you won't know that your initialization was in error. */ //declare a class class First { public: int count; First() {} //must have callable constructor }; //declare class containing static member of class First class Second { public: static First fVar; }; //initialize static member of class Second First Second::fVar = First(); //initialize with explicit call to ctor int main(void) { Second *sVarA = new Second; delete sVarA; return 0; } DISCLAIMER: You have the right to use this technical information subject to the terms of the No-Nonsense License Statement that you received with the Borland product to which this information pertains.