Skip to content

Instantly share code, notes, and snippets.

@trevorsibanda
Created June 18, 2017 18:31
Show Gist options
  • Save trevorsibanda/3bbf95ccc8770373591153f1d1a0ed52 to your computer and use it in GitHub Desktop.
Save trevorsibanda/3bbf95ccc8770373591153f1d1a0ed52 to your computer and use it in GitHub Desktop.
class A{
public:
A():v(0){}
A* incr(){
v++;
return this;
}
private:
int v;
};
class B: public A{
public:
B(int _v):A(_v),name(0){}
char* name;
};
int main(){
B* val = (new B(10))->incr();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment