Created
January 18, 2017 14:20
-
-
Save kopiro/4a2ec03b7a5cc580b293293b97dd8d8c to your computer and use it in GitHub Desktop.
Test RAII Class
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
#include <iostream> | |
class Two { | |
public: | |
void test() { std::cout << "Hello"; } | |
}; | |
class TwoRAII { | |
public: | |
Two* two; | |
TwoRAII() : two(new Two()) { } | |
~TwoRAII() { delete this->two; } | |
}; | |
int main() { | |
TwoRAII tr; | |
tr.two->test(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment