#include <iostream>
struct base
{
void f() const
{
// check preconditions here
f_impl();
// check postconditions here
}
private:
virtual void f_impl() const = 0;
};
struct derived :
base
{
void f() const
{
// check preconditions here
f_impl();
// check postconditions here
}
private:
virtual void f_impl() const
{
std::cout << "derived::f_impl()" << std::endl;
}
};
int main()
{ }