You are using setData
on object of class A
, but calling compare
on object of class B
. Use b
in both case.
int main()
{
A a;
B b;
//int c;
clrscr();
b.setData(25,9);
cout<<"answer: "<<b.compare();
getch();
return 0;
}
also change signature of main
method.
3
solved C++ is not Giving Expected output [closed]