159. An example of overloading member function?

#include<iostream.h> #include<conio.h> class overloading { public:                 int sum(int a,int b)                                 {                                 return (a+b);                                 }                 void sum(int c,float d)                                 {                                 cout<<"Sum = "<<c+d<<endl;                                 } }; void main() {                 int x=15,y=20,sum;                 float z=25.5;                 overloading f;                 clrscr();                 f.sum(x,z);                 sum=f.sum(x,y);                 cout<<"Sum = "<<sum<<endl;                ... Continue Reading →

Advertisements

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: