[Qt-interest] tracking uniqueness

Thiago Macieira thiago at kde.org
Sat Apr 24 10:28:50 CEST 2010


Em Sábado 24. Abril 2010, às 10.10.29, Oliver Heins escreveu:
> Andreas Pakulat <apaku at gmx.de> writes:
> > You seem to have a bit of misconception about this. There is no Editor
> > instance in your code. All you do is declare a class and a nested class,
> > both can be used without an instance of the other as far as your example
> > goes. In particular, this:
> > 
> > class Editor
> > {
> > 
> > public:
> >   class Token
> >   {
> >   };
> > 
> > };
> > 
> > Editor::Token t;
> > 
> > is perfectly valid compiling code. And there's no instance of Editor
> > generated here, there's only a single instance of Token.
> 
> So it's not possible in C++ to describe the idea: »Every instance of
> Token is held by an instance of Editor«?

Of course it is.

The counter is per editor, right? So it's a property of the editor.

Put it in the Editor class.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100424/e5c6c027/attachment.bin 


More information about the Qt-interest-old mailing list