Class is a blueprint in which characteristics (properties) and behaviors (functions) are defined.
An example of class definition is:
In the example:
class is the keyword for class defining.Person - the name of the class.Object is an instance created from a class.
Using the defined class we can create objects and set properties.
Output:
Explanation:
lines 1 - 6 a class is defined.
introduceYourself
that uses the properties of a class object via the this keyword.line 9 an object is created.lines 12 and 13 values are set to the members.lines 15 the function introduceYourself is called
and a message is printed.