What Is A Constructor?
What Is A Constructor?
class_name
{
public: The three basic types of
class_name( parameter list) constructor available in c++ are :
{
function body //constructor function Default constructor.
Parameterized constructor.
} Copy constructor.
~ class_name( parameter list)
{
function body // destructor function
}
};
Default Constructor
A constructor that accepts no parameters is called default constructor.
To declare a class distance to store distance in feet and inches. Inches will increment by 1 if
++ operator is used with the object i.e. ++ operator is overloaded.