+ 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

17th Jan 2022, 3:48 AM
Daniel Cooper
Daniel Cooper - avatar
3 Answers
+ 2
Okay, good enough a reason XD Good luck buddy! 👍
17th Jan 2022, 6:00 AM
Ipang
+ 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?
17th Jan 2022, 4:12 AM
Ipang
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.
17th Jan 2022, 4:30 AM
Daniel Cooper
Daniel Cooper - avatar