×

Html & Html5

The World's best Software Development Study Portal

Class and Object


Class

-Class is an template or blueprint that describe state/behaviour of an object.

-Properties of class known as attributes.

-Function which act on attribute are method.

Create Class

To create class use the keyword class

Syntax:-

class classname {

fields;

method;

}


Object

An objects have state and behaviour.Object is an instance of class.It is implemented in real world.

For.eg-Dog State-color,name,breed behaviour-bark,eat etc.