>>The only problem is that any descendents would have to be declared in the
same unit

Just offer public/protected get/set method to access that variable will
solve the problem.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
Behalf Of Matt Dee
Sent: Friday, February 21, 2003 2:40 PM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Delphi shared class data members?


In the unit the Class is defined, have a variable located in the
Implementation section that the methods read/write to.  Because it's in the
Implementation section it's hidden from the outside.  The only problem is
that any descendents would have to be declared in the same unit, as
otherwise they wouldn't have access to it. (That is, the inherited methods
from the base class would, but any new methods in the descendents
wouldn't.)

(Or put the variable in the Interface section, but then it's no longer
private.)

> They work like this: a data member is declared as Shared (scope can be
> specified normally) and all instances of the class and its descendants
> share the same variable - a bit like having a global with class scope.  I
> can see how they'd be useful in some situations.
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/


---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to