class vs object



Class is a type of template from which objects can be created. Classes are static and they give a blueprint to create the object. Classes have state and behavior. For example you take the example of human. Human have eyes, hands which are state of the class human and walking and talking are the behavior or action of that class.

class vs object
class vs object

You can take another example of animal. Animal is the class which has general scope and Dog is more specific scope and if we take about any dog then it is an object of class animal and dog itself. Some dogs are black in color and some are white. So they are some what using the class behavior like barking and some dogs have more specific behavior like some dogs run fast.

To use the class in the program we have to create instance of that class and that instance will be named object of that class.


Comments 0

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

class vs object

log in

reset password

Back to
log in