Computer Science, asked by satyajeet57, 2 months ago

Explain classes and object in c++​

Answers

Answered by Priyapragya
2

Answer:

Class: A class in C++ is the building block, that leads to Object-Oriented programming. It is a user-defined data type, which holds its own data members and member functions, which can be accessed and used by creating an instance of that class. A C++ class is like a blueprint for an object.

  • A Class is a user defined data-type which has data members and member functions.
  • Data members are the data variables and member functions are the functions used to manipulate these variables and together these data members and member functions defines the properties and behavior of the objects in a Class.
  • In the above example of class Car, the data member will be speed limit, mileage etc and member functions can be apply brakes, increase speed etc.

Object:An Object is an instance of a Class. When a class is defined, no memory is allocated but when it is instantiated (i.e. an object is created) memory is allocated.

Explanation:

Mark me as the brainliest Please If my answer is useful and also thank my  answers..

Attachments:
Similar questions