#include<iostream>using namespace std;class base{public:base(){prepare();cout<<"base new "<<endl;}~base(){cleanup();cout<<"delete base"<<endl;}virtual void prepare(){cout<<"base's prepare"<<endl;}virtual void cleanup(){cout& Read More
posted @ 2012-10-14 21:38 孙铭泽 Views(196) Comments(0) Diggs(0)
C++类String的实现代码:#include<iostream>using namespace std; class String{ friend ostream& operator<< (ostream&,String&);public: String(const char* str=NULL); //赋值构造兼默认构造函数(char) String(const String &other); //赋值构造函数(String) String& operator=(const String&other... Read More
posted @ 2012-10-14 20:56 孙铭泽 Views(190) Comments(0) Diggs(0)