#include using namespace std;
Class myclass {public: myclass () {mchar = 'a';}; static char * str; static void print (void); Friend Void PrintPrivate (MyClass & myclass); private: char mchar;};
Char * myclass :: str = "this is a static var";
Void myclass :: print (void) {cout << str << endl;}
Void PrintPrivate (MyClass & myclass) {cout << myclass.mchar << endl;
Void main () {myclass :: print (); myclass myclass; printprivate (myclass);
}
Char * myclass :: str = "this is a static var"; when initializing the STR, because the type is written, for example, you declare: static char * STR; then you initialize this when you initialize: Char * myclass :: str = "this is a static var"; Friend: There is a meticone, not part of the class, but can access private members in the class.