geekband-Third week course Essentials record

Source: Internet
Author: User
To make a record of the nature of the syllabus, to think in terms of an outline, to have an expanded reading Supplement 1, consider what kind of connection and relationship the class can have: combination, delegate, inherit 2, combination: Object delegate containing other classes: Contains and expands, mostly public inheritance, is-a 3, virtual functions: Non-virtual functions, virtual function (virtual), pure virtual function (virtual, function behind =0) 3.1 virtual function: The virtual function of C + + is "runtime polymorphism", and the implementation of virtual function is provided in the parent class, which provides the default function implementation for subclasses. Subclasses can override the virtual functions of the parent class to implement the specialization of subclasses. 3.2 Pure virtual functions: Classes in C + + that contain pure virtual functions are referred to as "abstract classes". Abstract classes cannot use the new out object, only subclasses that implement the pure virtual function can be new out of the object. Pure virtual Functions in C + + are more like "provide only declaration, no implementation", are the constraints of a subclass, and are "interface inheritance". Pure virtual Functions in C + + are also a "run-time polymorphism". 3.3 Normal function: is statically compiled, no run-time polymorphism, only according to the pointer or reference to the "literal" class object, call their own normal function. The normal function is the "enforced implementation" provided by the parent class for the child class. Therefore, in an inheritance relationship, subclasses should not override the normal functions of the parent class, because the invocation of the function is related to the literal value of the class object. 4, Combination plus inheritance: subclasses inherit from the parent class, the subclass contains an object of another class, the parent class and the object which is constructed first? 5, delegation plus inheritance: can be said to be the basis for the realization of the observer pattern

geekband-Third week course Essentials record

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.