Code: #include<iostream.h> #include<conio.h> class addition { public: int a,b,sum; float c,d,sum1; int add(int,int); float add(float,float); int mul(int,int); float mul(float,float); void getdata() { cout<<a; cout<<b; cout<<c; cout<<d; } }; int addition :: add(int x,int y) { sum=x+y; return sum; } float addition :: add(float x,float y) { sum1=x+y; return sum1; } int addition :: mul(int x,int y) { sum=x*y; return sum; } float addition :: mul(float x,float y) { sum1=x*y; return sum1; } void main() { clrscr(); addition a; a.getdata(); int a2=a1.add(a1.a,a1.b); float a3=a1.add(a1.c,a1.d); int a4=a1.mul(a1.a,a1.b); float a5=a1.mul(a1.c,a1.d); cout<<"\n Addition int "<<a2; cout<<"\n Adition Float"<<a3; cout<<"\n Multiplication int "<<a4; cout<<"\n Multiplication float"<<a5; getch(); }

its showing u error coz u r using a1 as a member access u need to define a class variable as addition a1 and then use a1 and it will work fine.....always c++ needs a variable which acts as a class which inturn can access class objects and methods....