博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
class layout basic 2
阅读量:5117 次
发布时间:2019-06-13

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

#include
using namespace std;//虚函数和析构函数需要定义,否则//a missing vtable usually means the first //non-inline virtual member function has no definition.class a{ virtual void func(){};public: virtual ~a()=default;//析构函数需要为public}aObj;class b :public virtual a{ virtual void foo(){};public: virtual ~b()=default;}bObj;class ax{ virtual void func(){}; char x;public: virtual ~ax()=default;}axObj;class bx:public virtual ax{ virtual void foo(){};public: virtual ~bx()=default;}bxObj;class c{ virtual void func(){};public: virtual ~c()=default;}cObj;class d :public c{ virtual void foo(){};public: virtual ~d()=default;}dObj;class cx{ virtual void func(){};public: virtual ~cx()=default; char x;}cxObj;class dx:public cx{ virtual void foo(){};public: virtual ~dx()=default;}dxObj;int main(){ cout<<"aObj "<
<

 

转载于:https://www.cnblogs.com/Searchor/p/9526566.html

你可能感兴趣的文章