C ++ basic tutorial (original)

Source: Internet
Author: User

1: each time a class is loaded, only the constructors at the time of loading are used. That is to say, when multiple constructors are defined in the class, only one of them can be used.
2: When no constructor is specified for the base class, all constructor defined by the inherited class cannot specify the base class constructor called, or
By default, only the default constructor of the base class is called.
3: When the base class only defines the default constructor, all constructor that inherits the class definition can only be specified to call the default constructor of the base class, or
By default, the default constructor of the base class is called.
4: when the base class defines multiple constructors, all constructors that inherit the class definition can specify to call the Default constructors of the base class at will.
If this parameter is not specified, the default constructor of the base class is called.

Subclass
1: When the inherited class object is copied to the base class object, the base class object can reference all available resources of the base class, but cannot reference the members of the inherited class.
In this case, the member value of the base class object is updated without affecting the state of the inherited class subobject. On the contrary, it cannot be copied, which is called subclass.
2: If the assigned object is of the pointer type, the pointer of the inherited object is assigned to the pointer variable of the base class. At this time, the member value of the base class object is updated.
, Affects the State of the Child object of the inheritance class, because the pointer variable points to the inherited class object.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.