博客
关于我
c++中虚析构函数的使用
阅读量:346 次
发布时间:2019-03-04

本文共 1430 字,大约阅读时间需要 4 分钟。

???????????

?C++???????????????????virtual????????C++?????????????????????????????????????????????

C++??????????????????????????????C++????????????????vtable?????????????????????????????????????????????????????

?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

??????????????????C++?????????????????????????????????????????????????????????????????????????????????????????

?????????

???????????

class Base {public:    Base() {}    ~Base() { std::cout << "??Base??" << std::endl; }};class Derived : public Base {public:    Derived() {}    ~Derived() { std::cout << "??Derived??" << std::endl; }};

?????????Base????????????????Base*????Derived????????Base??????Derived??????????????????????????????????Derived??????????????

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????final?????????

???????????

???????????????????????????

  • ???????????????????????????????????

  • ??????????????????????????????????????????????????????????????????????

  • ?????????????????????????????????????????????????derived????private???????????????????????????

  • ??final????????????????????????????????????????????????????final?????????????????

  • ??????????????????????????????????????????????????

    ??

    ?C++????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

    转载地址:http://anxq.baihongyu.com/

    你可能感兴趣的文章
    Python 中的 *tuple 和 **dict 是什么意思?
    查看>>
    Python 中的 filter() 函数:筛选可迭代对象元素
    查看>>
    Python 中的 Pillow 不允许我打开图像(“超出限制“)
    查看>>
    Python 中的 threading 模块和 multiprocessing 模块有何区别?
    查看>>
    Python 中的 threading 模块和 multiprocessing 模块有何区别?
    查看>>
    Python 中的 Turtle 库详解
    查看>>
    Python 中的 __slots__ 属性有什么作用?
    查看>>
    Python 中的... 三点、箭头(->)、/ 分别的作用
    查看>>
    python读取json数据的id_python处理JSON数据
    查看>>
    Python 中的Duck Typing
    查看>>
    Python 中的for in 遍历生成字典、添加判断条件if
    查看>>
    Python 中的Lock与RLock
    查看>>
    Python 中的range(),arange()函数
    查看>>
    Python 中的内存管理机制
    查看>>
    Python 中的函数包装器:模型运行时和调试
    查看>>
    Python 中的列表理解和 lambda
    查看>>
    Python 中的多层for in嵌套循环使用
    查看>>
    Python 中的多线程(01/4)
    查看>>
    Python 中的多进程(01/2):简介
    查看>>
    Python 中的多进程(02/2):进程之间的通信)
    查看>>