FA> Is it possible to make a class aware of another instance of itself ?
FA> If it is, how would that be done ?
Have a static data member that counts instances -- increment it in all
constructors (remember to define your own copy constructor) and decrement it
in the destructor.
Of course, this only works when your program doesn't involve threads or
exceptions. If you want thread safety and exception safety this scheme
becomes much more complex to implement than two extra lines of code. (-:
¯ JdeBP ®
--- FleetStreet 1.19 NR
---------------
* Origin: JdeBP's point, using Squish (2:440/4.3)
|