Home > Backend Development > C#.Net Tutorial > What is the definition of class in c++

What is the definition of class in c++

hzc
Release: 2020-06-19 17:37:16
Original
9183 people have browsed it

What is the definition of class in c++

What is the definition of class in c?

It is to define data of a class type. Class type is a significant feature of C language. , which is not available in C language.

For example, a class is equivalent to the type we talk about in real life. For example, if we define the class "people", then people include men and women; or they can be seen as including the elderly, adults, and children; or they can be seen as Including good guys and bad guys. etc. . .

The same is true in C language. To define a class Class is to define a class of different data objects with common characteristics. This object is called a data member, and the function that operates on this data member is called a member function. That's it. , they are combined to form an abstract data type, a class type.

In short, a class is an abstraction of the common properties and operations of a group of objects. Classes represent generality, while each object of a class represents specificity.

为了在程序中创建对象,首先必须定义类。C++语言用保留字class定义一个类,一般形式为:
class 类名
{
public:
<共有数据和函数>
protected:
<保护数据和函数>
private:
<私有数据和函数>
};
这就是类的定义
Copy after login

Recommended tutorial: "c "

The above is the detailed content of What is the definition of class in c++. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template