Saturday 1 September 2007

Properties of constructor in c++ with example

Properties of constructor:
(1) Constructor is special type function which must has same name of class name.
(2) Constructor doesn’t return any data type even void
Example:
#include
#include
class school
{
char *name;
int capacity;
public:
void school();
void display()
{
cout<
#include
class math
{
int a;
float b;
public:
math(int p,float q) //constructor should be in

No comments:

Post a Comment