[DUG] class variables - bad language definition

Myles Penlington myles at ams.co.nz
Tue Oct 9 11:47:58 NZDT 2007


Then does 

type
   Taa = class()
   private
     class var xx : yy;

   private
      zz : integer
  public



Work as expected? I.e zz is an instance variable?

 

Myles.

 

From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz]
On Behalf Of Rohit Gupta
Sent: Tuesday, 9 October 2007 11:44
To: NZ Borland Developers Group - Delphi List
Subject: [DUG] class variables - bad language definition

 

Another pitfall for young players.

type
   Taa = class()
   private
     class var xx : yy;
      zz : integer
  public


The xx declaration makes all other variables after it class ones as
well.  I know its documented, but one doesn't realise the impact until
after falling in the hole.  And the hole remains in my code for a future
developer to fall into.  This is specially bad after being used to the
class function declaration which works differently.

I hate this sort of stuff, the code can not become more robust if a
declaration of a new variable affects previous declarations.

-- 

Rohit Gupta

B.E. Elec.   M.E.   Mem IEEE    Associate IEE

Technical Manager

Computer Fanatics Limited

 

Tel     +64 9 4892280

Fax    +64 9 4892290

Email  rohit at cfl.co.nz <mailto:rohit at cfl.co.nz> 

Web    www.cfl.co.nz <http://www.cfl.co.nz/> 

 

________________________________

This email and any attachments contain information, which is
confidential and may be subject to legal privilege and copyright. If you
are not the intended recipient, you must not use, distribute or copy
this email or attachments. If you have received this in error, please
notify us immediately by return email and then delete this email and any
attachments. 



Attention:
This communication is confidential and may be legally privileged.  If you are not the intended recipient, please do not use, disclose, copy or distribute it, other than to return it to us with your confirmation that it has been deleted from your system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.adventureeducation.co.nz/pipermail/delphi/attachments/20071009/e358f0cd/attachment.html


More information about the Delphi mailing list