C++????????????????????????
???????????? ???????[ 2014/12/22 11:53:20 ] ????????C++ ?鹹???? ???????
????????
??????????????
???????????????????????????????????most derived class?????????????????????????????????????????????
?????????C++?У???????????????????????????????????????????????????????????????????????δ???????????????д??????????????????????????????????????????????????????????????????“????????”???????????й?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????麯????????麯?????????????Я??????????????Щ??????????????????????????????????麯????????????£?????????????????? vptr??virtual table pointer???麯??????????????????vptr ??????????? vtbl??virtual table???麯????????????????飬?????????麯???????????? vtbl?????????????????麯????????????ú??????????????????????????? vptr ???? vtbl??????? vtbl ???????????????????????????????????????
???????崿????????????pure virtual destructor??
???????????????????ж??壻?????????????????????????????????????????????????????
????class File //an abstract class
????{
????public:
????virtual int open(const string & path?? int mode=0x666)=0;
????virtual int close()=0;
????//...
????};
????????????Щ????£????????????????????????????????????????????????????????????????????????????????????????????????????????????????
????class File //abstract class
????{
????public:
????virtual ~File()=0; //declaration of a pure virtual dtor
????};
????File::~File() {} //definition of dtor
???????????崿???????????????????
????????????????????????????????????????????????????????????????????????????????????á?
??????????????????????????????ж??壬???????????????runtime??????????????????£??????????????????????????????????????????????????????????????????dummy implementation???????????????????????????????
????class DiskFile : public File
????{
????public:
????int open(const string & pathname?? int mode);
????int close();
????~DiskFile();
????};
????File * pf = new DiskFile;
????//. . .
????delete pf; //OK?? ultimately invokes File::~File()
???????Щ?????????????????????????????????????????????????ó???????????ó???????????????磬??????????????????????????????????????????У??????????????????????????????????????????塣
????class Abstract
????{
????public:
????virtual int func()=0;
????//..
????};
????int Abstract::func()
????{
????std::cerr<<"got called from thread " << thread_id<<
????"at: "<<gettimeofday()<<std::endl;
????}
??????????????????????ж????麯??????????????????λ?????????????麯???????彫?????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11