Do I have to override functions in a base class?
Hello, everyone. I'm trying to get my head around overriding functions of a base class, in C++. In this code:
Code:
class Base {
public:
Base() {}
virtual ~Base() {}
virtual foo() {}
virtual bar() = 0;
};
1. My understanding is that bar() must be overridden in any derived class that is instantiated. Correct?
2. Is it the case that any derived class may or may not implement its own constructor and/or destructor and/or foo(), and it's completely okay? In any combination?
Richard