nus-cs2103-AY2324S2 / forum

16 stars 0 forks source link

Quiz 6 Question 22 Enquiry #903

Closed Jaspertzx closed 7 months ago

Jaspertzx commented 7 months ago

In Quiz 6 Qns 22, why this this False? image

What if the object was de-referenced in the newGame() function, something like:

Minefield minefield = new Minefield();
... ... ...
Minefield minefield2 = new Minefield();
minefield  = minefield2;

Won't the first minefield object be de-referenced and deleted? Or is it because there activation bar for the Minefield constructor is wrong and therefore the entire thing is wrong?

E0735389 commented 7 months ago

The problem is that the lifeline must not continue past the X. https://nus-cs2103-ay2324s2.github.io/website/se-book-adapted/chapters/uml.html#object-deletion

Jaspertzx commented 7 months ago

Got it, thanks!