What is the relation between Classes and Objects?

by naval| Views: 2081

How classes and objects are related in real word?
What is the difference between Classes & Objects in Object Oriented Programming?



Tags:  OOPS Interview

Answers (1)
 
kevin Said..

Class is a definition, while object is an instance of the class created. Class is a blue print while objects are actual objects existing in real world. A Class is a concept but object is its practical behavior. Like Human being is a class (concept) & me, you, Steve Jobs, Bill Gates are instance (Object, Practical behavior) of that class.

Another Example we have class CAR which has attributes and methods like Speed, Brakes, and Type of Car etc. Class CAR is just a prototype, now we can create real time objects which can be used to provide functionality. Example we can create a GT100 car object with 100 km speed and urgent brakes.

Another example: Class: country | Object, USA, China, India etc.



Register or Login to Post Your Opinion/Answer