C ++ should support separating declaration classes

Source: Internet
Author: User

It is inconvenient to use more C ++. The most important thing is the c ++ class declaration.

 

Sometimes we want to develop interfaces, but keep data and internal functions internally, rather than header files.

 

Another purpose of doing so is that if internal data is written in a structure that is not intended to be disclosed, I don't have to worry about encapsulating it.

 

Another benefit is that if there is an automatic generationCodeTo isolate the automatically generated code from the code that the user needs to modify.

 

However, splitting the class declaration also has many problems. The most important thing is that the class size cannot be obtained from the first file. In this way, C ++ is required to support the ability to dynamically obtain the class size, so as to correctly allocate space for the class instance.

 

Hope that the experts can propose solutions to this problem.

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.