[DUG] defining procedures outside of the private and public sections

Jolyon Smith jsmith at deltics.co.nz
Fri Nov 12 11:02:13 NZDT 2010


The default visibility in a class is "published".  Moving them to the
private section may be valid, but it also may be inappropriate, depending on
the intent of who/whatever introduced those methods to the class in the
first place.

As a general rule I'd say that the IDE form designer sets a bad precedent in
this respect.  Visibility should always be made explicit.


-----Original Message-----
From: delphi-bounces at delphi.org.nz [mailto:delphi-bounces at delphi.org.nz] On
Behalf Of Ayers, Stephen
Sent: Friday, 12 November 2010 10:28
To: delphi at delphi.org.nz
Subject: [DUG] defining procedures outside of the private and public
sections

Hi

I have just noticed some code that declares some procedures straight
under the class definition line.  For example:

Type
   TSomeClass = class(Tobject)
   
     Procedure AfterSomething(Sender: TObject)

 Private
  Somestring : String;

Public
  SomeOtherString : String.


Now I know that the Delphi designer puts all the text boxes, button
click events etc in this space on forms, but for a hand written class im
not sure why this has been done or what access it automaticity gets
assigned(private,public..)  Can anyone shed some light on this?  I am
inclined to just move those procedures into the private section as they
won't be used outside of the class. 

Thanks


Steve Ayers
Analyst Programmer




_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: delphi at delphi.org.nz
Admin: http://delphi.org.nz/mailman/listinfo/delphi
Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
unsubscribe



More information about the Delphi mailing list