Classes and Objects
Classes and Objects
▶ Class - A class can be defined as a template/blue print that describes the behaviors/states that
object of its type support.
▶ Object - Objects have states and behaviors. Example: A dog has states - color, name, breed as
well as behaviors -wagging, barking, and eating. An object is an instance of a class.
Examples
What goes in class???
▶ The class represents the blueprint of your object.
▶ The class must go within a pair of curly braces.
▶ Class has one or more methods.
▶ Methods should be declared inside class.
How to create Object of the class??