A class
in C++ represents a user-defined data structure. It’s similar to a C++ struct.
Concrete class
The basic idea of ocncrete classes is that they behave “just like built-in types”.
Classes without any abstract methods.
Abstract class
Classes with at least one abstract method.
An example of an abstract class is the following Container
:
class Container {
public:
virtual double& operator[](int) = 0;
virtual int size() const = 0;
virtual ˜Container() {}
};
Inheritance and implementation
Foo
implements Container
in the following example. Container
is the base-class and Foo
is the derived-class.
class Container {
public:
virtual double& operator[](int) = 0;
virtual int size() const = 0;
virtual ˜Container() {}
};
class Foo : public Container {
// ...
}