latest Post

C++ part 4 (constructor - Default Constructor)






So hey guys it's a long time that i have posted a article or blog .So hey i am back with a article about the constructor in C++ and this is continued to the series and we are going to start C language series also and you should also visit after launching it and if you not the other part of this series then i recommend that you should see them first and then this one .So this article or blog is all about the constructor in C++ not in Java .
parts of C + + series

STATIC VARIABLE

FRIEND FUNCTION

REFERENCE VARIABLE

So lets start ..............................................


CONSTRUCTOR

It is type of a member function that create or initialize  an object when the constructor is created. 
The constructor will automatically create or initialize an object.
Constructor have the same name as the class and not have any return type.
Whenever we creates an object it calls each time as default constructor.

Constructor are of 3 types :-

1. Default constructor.

2. Parametried Constructor.

3. Copy Constructor.

So today we are going to study the default constructor in constructor
and if you have any problem regarding this article or blog then please type in the comment box.

CODE...................................................



#include<iostream.h>
#include<conio.h>

class abc
{
             public:
                         abc ( )
                         {
                                   cout<<"constructor initialized";
                         }
};
void main ( )
{
                    abc a,b,c;
                    a.display( );
                    getch( );
}

The other constructor are also to be explained that are in next one.
So bye.........................................


About hack guru

hack guru
Recommended Posts × +

0 comments:

Post a Comment