DEFAULT CONSTRUCTOR OR ZERO
ARGUMENT CONSTRUCTOR
Constructor that does not take
any arguments is called as a zero argument constructor. The default constructor
provided by the compiler does not take any arguments. Hence the terms zero
argument constructor and default constructor are used interchangeably.
Example
for default or zero argument Constructor:
#include<iostream.h>
#include<conio.h>
class Area
{
Area ( ) //Default constructor or zero argument
constructor
{
cout<<”Object
(“<<c<<”) created”;
}
};
void main ( )
{
Area a1, a2;
};
No comments:
Post a Comment