Object-oriented, What Is Object-Oriented

Source: Internet
Author: User

Object-oriented, What Is Object-Oriented

Object-oriented concepts often have some special combinations, such as object-oriented analysis, object-oriented design, and the object-oriented programming implementation we will discuss below.

When programming, we often need to describe something with features that are external or expressive.

During programming, We need to operate on such things according to the characteristics of such things, that is, the process of "abstracting into a class.

C ++ provides three access permissions for members in the class: public, protected, and private. Represents all public, protected, and private.

For example, every student in a class has a student ID, score, and ranking ......

Therefore, what we need is to abstract a class )"

If they are all students, we can call this class "student" and write some member variables to describe them based on our needs.

Class student {

Public:

Int num;

Int age;

Int mc;

};

Now we have created a class. If there is a student named Tom, we can declare it in the main function as follows:

Student Tom;

Next we will assign values to Tom's student ID, score, and ranking attributes:

Tom. num = 15254264;

Tom. age = 85;

Tom. mc = 5;

In this way, we can describe the students in a class effortlessly.

 

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.