Want to write a technical essay

Source: Internet
Author: User

All of a sudden I want to write essays, but the brain is raised in some technical text. If you need to work, organize it.

Access control for C + + encapsulated members

Encapsulation often generates a type, which can be a union,struct/class;c++ all definitions will have an application scope, which we call the scope concept has always affected our work of compiling links, formerly C primitive only three scope concept, file domain, global domain, local area; C + + On this basis, coupled with the naming characteristics, it tells us more convenient to organize our code unit and granularity control; In addition to namespace, everything has a defined scope, naming is a domain name. The concept that deserves to be emphasized is the scope constraint.

Members decorate public:

Public, can be accessed by domain name or object;

Protected

The restriction is accessible within the scope of the genus, which requires the scope of the class or extension of the class;

Private

is completely limited by the scope of the class definition.

Extended control public:

The modified properties of the inherited member are unchanged;

Protected

In addition to the private members of the successor members of the other changes are more category of protection;

Private

The decorated attributes of an inherited member are locked to private.

Pimpl mode

Private implementation mode is a way to improve the efficiency of engineering compilation. To provide compilation efficiency, first of all to isolate the name pollution, reduce the compiler's scope to identify the load.

This mode is only applicable to a clear and reliable oo design, if unreliable instability, interface files to change, and constantly revised, that this mode is not suitable for work, because the private implementation must refer to a lot of intermediate code, this workload is not to be ignored. Therefore, designers are required to have mature oo design capabilities. The essence of OO design is to construct an easy-to-understand and action-based process model, so people who can't control the scope can't grasp the angle of view don't talk about design in front of everyone.

Often in order to isolate, we see that the package is like this;

// target.h Interface ITarget; class Private itarget{public:    ctarget (...);     // Proxy Mode     ... Private :    ITarget* p;}
// Target.cpp struct  pimpl:itarget{    /**/    ...};  // Pimpl, Private implementation ... Ctarget::ctarget (...) {    new Pimpl; // prepare the actual object }

In this way, this isolates the implementation with the interface declaration of two pieces of content. The implementation is already scoped to the target CPP, and a CPP is the compilation unit.

C#PartialKey words

This keyword appears in the C # language feature, which represents a wrapper that can be divided into multipart declarations. This is great, it teaches us to be more prone to separation of concerns, the categorization of information and the aggregation of complete functions.

Imagine if C + + would one day support such a feature. What are the benefits to us?

With the support of partial declarations, I do not have to declare it in the interface file, except for the data member, the data member division that C + + is not C + +, because sizeof is a compile-time operation, a type must be complete in the data structure. In order to calculate his size.

Of course, allowing separation is a good feature, but the compiler needs to consider the generic relationship, because the virtual keyword, for offsets, requires a compilation calculation. Therefore, as long as the virtual function of the genus polymorphism must be declared in. h.

Preserve record bit operations

Set bit: OR

Exclusion bit: XOR

Detection bit: and

Code Quality

Principle of proximity statement

Minimum dependency specification

Two words

To observe a person's taste and style through dress and dress;

To grasp a person's temperament and dynamics through manners and conversation;

Want to write a technical essay

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.