jeudi 30 avril 2015

Can someone provide me with a simple example of a unique_ptr being set and retrieved

How would i write the following with smart ptrs:

class App
{
    Project* GetProject();
    SetProject(Project* project);
}

Project project = new Project();
App app = new App();

app.SetProject( project );
Project* project = app.GetProject();

This is related to this question: Should i stop using * pointers? - A few entry questions

I am slightly confused at what the rules are now... Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire