Skip to content

Instantly share code, notes, and snippets.

@madbence
Created April 10, 2014 16:37
Show Gist options
  • Save madbence/10400351 to your computer and use it in GitHub Desktop.
Save madbence/10400351 to your computer and use it in GitHub Desktop.
#include<stdio.h>
struct Alma {
Alma& foo() { return *this; }
virtual void bar() { printf("alma"); }
};
struct Belma: public Alma {
void bar() { printf("belma"); }
};
int main() {
Belma b;
Alma& a = b.foo();
a.bar();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment