#include <iostream>

class Interface
{
public:
    virtual void someMethod() = 0;
    virtual void someOtherMethod() const = 0;
};

struct Impl : Interface {
  virtual void someMethod() { std::cout << "some method\n"; }
  virtual void someOtherMethod() const { std::cout << "some other method\n"; }
};
struct Proxy : Interface{
  Proxy(Interface* i) : i(i) {}
  Interface* i;
  void someMethod() { std::cout << "log "; i->someMethod(); }
  void someOtherMethod() const { std::cout << "log "; i->someOtherMethod(); }
};
class ConstProxy {
  Proxy p;
public:
  ConstProxy(Interface const* i) : p(const_cast<Interface*>(i)) {}
  void someOtherMethod() const { p.someOtherMethod(); }
  operator Interface const& () { return p; }  // imitiert "extends const Interface"
};

void foo( Interface& i )
{
  i.someOtherMethod();
}
void foo2( Interface const& i )
{
  i.someOtherMethod();
}

int main()
{
  Impl i;
  ConstProxy cp(&i);
  //foo(cp);
  foo2(cp);
}
