Posts

how to convert PDF file to MS WORD document

Image

how to fill cg post metric scholarship form

Image

How to resize photos online

Hello friends                         niche diye  gyee video me maine aapko bataya hai ki aap photo ki quality bina kam kiye uska size kaise kam kar sakte hai. watch this video watch on youtube

Definition and example of parameterized constructor.

PARAMETERIZED CONSTRUCTOR: - These are the constructors with parameter. Using this Constructor you can provide different values to data members of different objects, by passing the appropriate values as argument. The constructor with parameters can be used to initialize data members of the object. To create a constructor with parameters you have to specify its parameters in the parentheses as we do to specify parameters of a function. e.g. #include<iostream.h> #include<conio.h> class number { int itemcode,cost; public: number(int x,int y) { itemcode=x; cost=y; } void display() { cout<<"\n code= "<<itemcode; cout<<"\n cost= "<<cost; } }; void main() { clrscr(); number n1(192,356); cout<<"values for first object="; n1.display(); number n2(546,657); cout<<"\n value for second object="; n2.display(); getch(); }

EXAMPLE OF DEFAULT CONSTRUCTOR

Image
DEFAULT CONSTRUCTOR:-A constructor in which we can not pass any parameter this types of constructor are called default constructor. E.G.

WHAT IS CONSTRUCTOR ?

A Constructor is a special member function of class because its name is same as the class name.it is called constructor because it construct the values of the data member of the class and it cannot return any values. if a class has constructor each object of that type is initilized with the constructor to use in a program.constructor are called at the point where an object of the class is created.