Created
November 2, 2014 15:23
-
-
Save maluramichael/4337a58dddf904e2d282 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Foo { | |
public: | |
Foo() | |
{ | |
// wird weg optimiert oO | |
std::cout << "construct\n"; | |
} | |
~Foo() | |
{ | |
// der hier auch | |
std::cout << "destruct\n"; | |
} | |
void bar() { std::cout << "bar\n"; } | |
}; | |
int main(int argc, char* argv[]) | |
{ | |
std::shared_ptr<Foo> p; | |
// vorallem wie kann bar ausgegeben werden wenn Foo nicht richtig initialisiert wurde? | |
p->bar(); | |
std::shared_ptr<Foo> p2 = p; | |
p2->bar(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment