class A { public: A(); ~A(); //在A的实现部分中,GetStr仅是用来返回val CString *GetStr(); private: CString *val; } |
class B { public: char *GetStr(); private: A a; //在GetStr中调用A的操作,然后将CString转为char * } |
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |