Class is a blueprint in which characteristics (members) and behaviors (functions) are defined.
An example of class definition is:
In the example:
class
Person
lines 3 and 4
public
private
protected
Object is an instance created from a class.
Using the defined class we can create objects and set properties.
Output:
Explanation:
lines 2 - 11
name
age
introduceYourself
this
line 14
lines 17 and 18
lines 20