Skip to content

Instantly share code, notes, and snippets.

@domiyanyue
Last active August 22, 2020 04:01
Show Gist options
  • Save domiyanyue/9e795abb1ea663bfe75569f370546fc0 to your computer and use it in GitHub Desktop.
Save domiyanyue/9e795abb1ea663bfe75569f370546fc0 to your computer and use it in GitHub Desktop.
RAII example
class WrapperA{
public:
A *p;
WrapperA(){
p = new A;
}
~WrapperA(){
delete p;
}
};
int demo1(){
WrapperA a;
int r = a.p -> func();
return r;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment