Created
June 18, 2017 18:31
-
-
Save trevorsibanda/3bbf95ccc8770373591153f1d1a0ed52 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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