"C + + Primer Plus 6th" Reading notes-tenth chapter objects and classes

Source: Internet
Author: User

1. Procedural programming and object-oriented programming

2. Abstraction and Class

1. Programs that use class objects can access the public part directly, but only through public member functions (or friend functions) to access the private members of the object

2. You can define a member function outside of a class declaration and make it an inline function

3. Constructors and destructors for classes

1. A constructor that accepts a parameter allows an object to be initialized to a value using the assignment syntax

4. This pointer

5. Array of objects

6. Class Scope

1. The following class definition method is wrong and should not exist before declaring the class

1 class Bakery 2 {3private:4     Const int  A ; 5     Double Costs[month]; 6 }

There are two ways to solve

1 classBakery2 {3 Private:4     enum{Month = A};//Enumeration5     DoubleCosts[month];6 };7 8 classCakery9 {Ten Private: One     Static Const intMonth = A;//Static A     DoubleCosts[month]; -};

7. Abstract data types

"C + + Primer Plus 6th" Reading notes-tenth chapter objects and classes

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.