Notes

来源:互联网 发布:软件著作权申请八戒 编辑:程序博客网 时间:2024/05/03 09:11

Private inheritance means is-implemented-in-terms-of.there is no conceptual relationship between objects of types B and D,private inheritance is purely an implementation technique.

Public inheritance means "is a"

application domain:has a

implementation domain:artifacts,like buffers,mutex,search trees and so forth


four conditions that nontrivial default constructor  of the class is syntheized

1.Member Class Object with Default Constutor

2.Base Class with Default Constructor

3.class with a virtual function

The class either declares (or inherits) a virtual function
The class is derived from an inheritance chain in which one or more base classes are virtual

augmentations to do 

A virtual function table (referred to as the class vtbl in the original cfront implementation) is
generated and populated with the addresses of the active virtual functions for that class.
 Within each class object, an additional pointer member (the vptr) is synthesized to hold the
address of the associated class vtbl.

4.Class with a Virtual Base Class

There are four characteristics of a class under which the compiler needs to synthesize a default
constructor for classes that declare no constructor at all. The Standard refers to these as implicit,
nontrivial default constructors. The synthesized constructor fulfills only an implementation need. It
does this by invoking member object or base class default constructors or initializing the virtual
function or virtual base class mechanism for each object

0 0
原创粉丝点击