+ 1
What is the basis concept behind class and object in cpp?
please answer it very basic conceptually so that i can easily understand.
2 odpowiedzi
+ 5
class animal - object cat
0
the concept of objects is to represent real life.
If you need to have a contact application, without objects you must create several variables without any link between them. You can eventually use a structure.
Classes are a bit like advanced structures.
you create a class called person and then all variables related to thus will be included inside. like the name, the age, phone number....
Moreover with classes, you can create a class called employee for instance. And the employee inherite from person. So as in real life your employee is a person. So your employee will have a name, an age, phone numbers as a person. Then you can add a job variable in the class employee.
you see ?