C Class's characteristics (from other web site)

Source: Internet
Author: User
C Class is one derived from class cbase.
The cbase class has the following main characteristics:
* Data members are always zeroed upon construction if an object is created on the heap because operator new () is overloaded.
* Cbase has a virtual destructor
* Cbase has private copy constructor and assignment operator thus, the following characteristics of C classes arise:
* They shoshould always be allocated on the heap to ensure zero-initialization.
* They inherit the virtual destructor of the base class, so can be guaranteed to be cleaned up correctly.
* They need an explicit copy constructor or assignment operator if there is clear intention that a special class will support copying C classes typically have ownership of other C classes or resources that need cleanup. since these resources often have non-trivial construction and, because of the possibility that a leave might occur during the construction process, C classes typically use the two-phase construction idiom.
Related Article

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.