RosettaCodeData/Task/Respond-to-an-unknown-method-call/C++/respond-to-an-unknown-method-call.cpp
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

17 lines
266 B
C++

class animal {
public:
virtual void bark() // concrete virtual, not pure
{
throw "implement me: do not know how to bark";
}
};
class elephant : public animal // does not implement bark()
{
};
int main()
{
elephant e;
e.bark(); // throws exception
}