#include <iostream>
using namespace std;
class Cat{
public:
int mAge;
int mWeight;
virtual void innoculate()=0;
};
class Persian: public Cat
{
public:
virtual void innoculate()
{
cout << "successful innoculated" << endl;
}
};
int main()
{
//Cat c2; gives error: because Cat is a abstract class
Persian c1;
c1.innoculate();
return 0;
}
OUTPUT:
using namespace std;
class Cat{
public:
int mAge;
int mWeight;
virtual void innoculate()=0;
};
class Persian: public Cat
{
public:
virtual void innoculate()
{
cout << "successful innoculated" << endl;
}
};
int main()
{
//Cat c2; gives error: because Cat is a abstract class
Persian c1;
c1.innoculate();
return 0;
}
OUTPUT:
No comments:
Post a Comment