returning objects c++


when returning objects class, right redeem memory?



example,



class animallister 
{
public:
animal* getnewanimal()
{
animal* animal1 = new animal();
relapse animal1;
}
}


if i emanate an instance animal lister animal anxiety it, following where am i ostensible mislay it?



int main() {
animallister al;
animal *a1, *a2;
a1 = al.getnewanimal();
a2 = al.getnewanimal();
}


the problem here animallister doesnot have proceed lane list animals created, i change explanation such formula have proceed mislay objects created.



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?