Static member variable is a common variable for all of the instances of a class while each instance of a class has its own copy of an ordinary variable. 3.2 A class is a user-defined type. The difference between an object and a class is that an object is an individual instance of a class and a class is a type of that instance. In our program Rectangular is a class and r1 is an object. It creates an object and sets seconds to zero.
Constructor is a method with the same name as the class.
It gets called when we create an object of the class. Constructor's code initializes member variables and prepares everything that may be required by the object during its lifetime.