Explain me clearly about class and objects in cpp. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Explain me clearly about class and objects in cpp.

I want to get a correct view.

17th Jun 2018, 12:45 PM
prasanth vellingiri
prasanth vellingiri - avatar
5 Answers
+ 9
From what I understand: Class is a container for methods, variables. Objects are instance of classes.
17th Jun 2018, 12:55 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 7
Class is a container which binds the data member and member function.it is user defined data type for defining or creating objects related to real life. class is like structure...with a little modification. In class data member and member function are by default private however in structure these are public by default. In case of creating a simple variable suppose of integer data type... int x; now here..int is the data type and the variable is x. Similarly while declaring object..such as student s; student is the data type and s is the variable!!
19th Jun 2018, 6:04 PM
Sia
Sia - avatar
+ 3
Class is an advanced struct where besides the data (variables) there can be also functions (methods). Classes and objects are core of object- oriented programming where any entity will present as class (scheme). You can think of the class as a custom type. If the class is a data type, (like int or float) than the object is a variable of this type.
17th Jun 2018, 1:31 PM
Indiegma
Indiegma - avatar
+ 2
class is the entity of objects that means.. let's take an example mango, apple, grapes are the objects that belongs to class fruits....
26th Jun 2018, 2:43 PM
NEHA CHHATRIA
NEHA CHHATRIA - avatar
+ 2
i want the fast way to calculate the reminder, please 😊
26th Jun 2018, 4:58 PM
Dina Elsemedsy
Dina Elsemedsy - avatar