Self-deleting objects in ArrayList?
in
Programming Questions
•
2 years ago
How can I have an object delete itself from an ArrayList, preferably in a function in that object's class?
I guess one way would be if the object knew what its number in that ArrayList was, as in
- if ( !alive )
- {
- aList.remove( objectPosition );
- }
1