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 i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members