.
Home About-us Privacy Policy Contact-us Services

Thursday, October 8, 2015

C++ Program to concept of default constructor

ad+1

Program - 


#include<iostream.h>
               #include<conio.h>
class abc
{
private:
int rn;
float fees;
public:
abc(int a=20,float b=1200.25);
void write(void)
{
cout<<rn;
cout<<fees;
}
};
abc::abc(int a,float b)
{
rn=a;
fees=b;
}
void main()
{
class abc m1(320),m2(54,320.23);
clrscr();
m1.write();
m2.write();
getch();
}


Output - 



3201200.2554320.230011

0 comments:

Post a Comment

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates