latest Post

C++ part 5 ( constructor - parameterized constructor )



So hey guys we are back with constructor and this is parameterized constructor and this is different from the previous one which is default constructor so don't be confused in this and the previous one.
And if you don't see our previous article of this series i must recommend you that you should see it first and then this one.
So lets start..............................................................

parameterized

PARAMRTERIXED CONSTRUCTOR

The constructor which support the parameters and can run with parameters.

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

#include<iostream.h>
#include<conio.h>
class abc // anme of the class is abc
{
              int i ; // name of the variable is a which have datatype integer
              public :
                         abc(int m) // parameterized constructor
                         {
                                    i=m ;
                         }
};
void main( )
{
            abc a(20) ;
            a.display() ;
            getch() ;

}          
So if you have problem in the article please write in the comment box .


About hack guru

hack guru
Recommended Posts × +

0 comments:

Post a Comment