You use of the
class
keyword is wrong when defining a
swap
class variable.
Instead of using
void main()
{
clrscr();
class obj;
obj.getdata();
obj.display();
getch();
}
use
void main()
{
clrscr();
swap obj;
obj.getdata();
obj.display();
getch();
}
You can read these short tutorials to increase your knowledge about classes and variables:
Classes (I)[
^]
Variables. Data Types.[
^]