My Blog List

Saturday, November 9, 2019

program for constructor overloding in cpp



#include<iostream.h>
#include<conio.h>
#include<string.h>
class student
{
int roll;
char name[20];
public:
student(){};
student(int r,char n[])
{
roll=r;
strcpy(name,n);
}
void show()
{
cout<<"\nRoll number:"<<roll;
cout<<"\nName:"<<name;
}
};
void main()
{
student s,s1(18,"Mayur");
clrscr();
s.show();
s1.show();
getch();
}




No comments:

Post a Comment

Multiple Inheritance in C++.

     In this tutorial Multiple Inheritance in c++. On the basis of Inheritance concept the another type of inheritance is the Multiple I...