c++ 继承

单继承                                                              多继承

class ImageBook:public Book {  }                 class ImageBook: public Book, public Image  {             };

virtual inheritance ://li例子如下

class  Book :virtual public Paper {  };

class   Image : virtual  public Paper {  }

 class ImageBook: public Book, public Image  {             };// 只会出现一个 Paper 几类 ,使用virtual 继承的话

only a single occurrence of the base class is maintained (called a
subobject) regardless of how many times the class is derived from within the inheritance chain

posted on 2012-10-30 10:50  GIS-MAN  阅读(154)  评论(0编辑  收藏  举报

导航