C + + Primer Plus Study: Tenth chapter

Source: Internet
Author: User
Procedural programming and object-oriented programming

Object-oriented Programming (OOP) Features:

  • Abstract
  • Encapsulation and data hiding
  • Polymorphic
  • Inherited
  • Reusability of code
Abstractions and classes

A class is a C + + tool that translates abstractions into user-defined types, which synthesize a concise package of data representation and manipulation of data.

Constructors and destructors for classes

Constructor: Same as class name

Destructor: ~ Class name

Object Initialization method:

ClassName Cn=classname (...); or classname cn (...);

If the member function of a class does not modify the calling object, it should be identified as a const type, such as: Void Show () const;

This pointer

The this pointer points to the calling object of the class. *this represents an object.

Class scope

The names defined in the class are scoped to the entire class.

A constant scoped to a class

Enum{k=19};int A[k]; static cons tint k=19;

Abstract data type

C + + Primer Plus Study: Tenth chapter

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.