Skip to content

Instantly share code, notes, and snippets.

@TvdW
Created July 9, 2011 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TvdW/1073174 to your computer and use it in GitHub Desktop.
Save TvdW/1073174 to your computer and use it in GitHub Desktop.
C++ memory object extending
class Sheep : Object {
void makeNoise();
};
int main() {
Sheep* sheep = new Sheep; // it is automatically retained once.
// Do stuff with the sheep
sheep.release(); // it is deallocated
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment