I have a header file which declares the prototype for the constructor. In a separate file I have the constructor and all other methods declared outside the class. The constructor must initialize constants as well.
How do I define the prototype,开发者_高级运维 with the : constant_name(constant arg), etc..
or without and just write it in full form in the external file?
//---- prototype Some.h ----//
class Some {
private: const int MAX_LENGTH;
public:
Some();
}
//---- implementation Some.cpp ----//
Some::Some() : MAX_LENGTH(512)
{
}
精彩评论