C + + Learning 3

Source: Internet
Author: User

Virtual inheritance (Virtual inheritance):

Syntax: Class Subclass:virtual public baseclass{}

The virtual inherited class (subclass) has no copy of the parent class (BaseClass), and in the subclass of subclass, the constructor should call the BaseClass constructor.

Program error: Compile-time error, run-time error.

Dynamic Memory:

No name, only address, run-time assignment.

Delete only frees memory, the pointer is still in, and the pointer value is still there.

The combination of array name and subscript operator can be considered as: array base address and corresponding pointer operation.

To return memory from a function or method: Call the new statement in a function to allocate a chunk of memory for an object or a data type, and then return the address of the block of memory to the program's main code.

You cannot return the address of a local variable

function pointer: A pointer to the first address of the function is called a functional pointer

Pointer functions: Functions that can return pointer-type data

Replica Builder:

Will copy the corresponding property, but the pointer??? After copying, copy the address, then there will be two objects to control the address ....

Overloads the operator, overloading the assignment operator ("="), in which the pointer is processed: assigns a new position and copies the value past.

The declaration is always assigned a value: MyClass (const MyClass &RHS), which requires a reference of a MyClass type as an input parameter, just like an assignment operator, because it is a constructor that does not require a return type.

The dynamically allocated block of memory is not scoped, but the pointer variable used to hold the address is affected by the scope.

C + + Learning 3

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.