I work on my course with C ++, and wanted to use a Python class variable access feature. Here's an example:
class Telefone:
nums = {}
def __init__(self, numero):
self.num = numero
Telefone.nums[numero] = self
print(list(Telefone.nums))
joao = Telefone(40028922)
paulo = Telefone(30302020)
pedro = Telefone(55677655)
Output:
[40028922]
[40028922, 30302020]
[40028922, 30302020, 55677655]
How do I do this in C ++?