You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Here is an example of a C++ "template mixin", whereby interfaces are
related by inheritance in a way that is covariant to the relationship
between the abstract and concrete classes that implement them.
This new pattern is compatible with the object oriented SOLID principles
and is a way of using single inheritance to avoid the problems associated
with multiple inheritance.
Here the interface classes (denoted by the i_ prefix) are implemented by
the template mixin and the concrete class that derives from it. Note:
inheritance relationships being modeled here are of the "is-a" kind.
struct i_foo
{
virtual void m1() = 0;
};
struct i_bar : i_foo
{
virtual void m2() = 0;
}
template <typename base = i_foo>
struct foo : base
{
void m1() final { /*...*/ }
};
struct bar : foo<i_bar>
{
void m2() final { /*...*/ }
}