Hi Guys,

Im having issues with clearing an object of a class.

Currently I have 2 lists

class People
list<char> person
class School
list<people> teacher

i add the contects of person into people;

i read by executing the printChar function created in People whilst iterating in the School list.

itr -> printChar

the problem is that im getting the following issue it is printing like this

value 1 of list teacher = Marge
value 2 of list teacher = Marge + Homer
value 3 of list teacher = Marge + Homer + Bart.

This is because i havent cleared the object of class People when adding it to School.

I have tried people student = new people(); But i get an error about 'void value not ignored as it ought to be'

i think


is what you're searching for. Read about it here

Click Me