C++: calling non-member functions with the same syntax of member ones
- by peoro
One thing I'd like to do in C++ is to call non-member functions with the same syntax you call member functions:
class A { };
void f( A & this ) { /* ... */ }
// ...
A a;
a.f(); // this is the same as f(a);
Of course this could only work as long as
f is not virtual (since it cannot appear in A's virtual table.
f doesn't need to access A's…