+ 1
Cpp member vector question
Alright so I'm writing useless code, and for no reason other than it's really bothering me being outside the class, I need to know if it's possible to have a vector that's storing objects be a member of the class it's storing from. Here's the code I've written. https://code.sololearn.com/c3V1U1doqi4P/?ref=app
3 Antworten
+ 2
Okay, good enough a reason XD
Good luck buddy! 👍
+ 1
But why you want to do this? the collection stores person instances, but here you want a single person instance to contain a collection of person?
0
Ipang Not exactly. If successfully implemented, the member would be static and wouldn't rely on any specific instance.
As for the reason, it just bothers me being outside the class. Like, that's the only reason. I know logically I don't need to, but it would greatly satisfy me if I could, lol.