Solved

Can Public be declared more than once.

Posted on 2009-07-03
3
147 Views
Last Modified: 2012-05-07
Dear Experts,

I have some code on EE that i have put in the code-secion.
you see that the word Public has been declared twice.
Can this be done?, or is it an error and it has to be Published!

Peter Kiers

type
  TItem = class(TObject)
  private
    fStatus: byte;
    fParentID: integer;
    fNodeText: string;
    fID: integer;
    fData: string;
    fSaver: TAdoQuery;
    fChanged: Boolean;
    fSaveImmediate: boolean;
    fIsNew: Boolean;
    fImageIndex: integer;
    procedure SetData(const Value: string);
    procedure SetNodeText(const Value: string);
    procedure SetParentID(const Value: integer);
    procedure SetStatus(const Value: byte);
    procedure SetImageIndex(const Value: integer);
  protected
    procedure Changed; dynamic;
  public
    constructor Create(aSaver: TAdoQuery; AId, AParentID: integer; AStatus: byte);
    constructor LoadFromDataset(aSaver: TAdoQuery);
    procedure Save;
    procedure Delete;
    procedure BeginUpdate;
    procedure EndUpdate;
  public
    property ID: integer read fID write fID;
    property ParentID: integer read fParentID write SetParentID;
    property ImageIndex: integer read fImageIndex write SetImageIndex;
    property Status: byte read FStatus write SetStatus;
    property Data: string read fData write SetData;
    property NodeText: string read fNodeText write SetNodeText;
  end;

Open in new window

0
Comment
Question by:peterkiers
3 Comments
 
LVL 11

Accepted Solution

by:
dougaug earned 500 total points
ID: 24772337
I've compiled the class above and didn't get any errors. I didn't understand why public has been declared twice?

There is no problem to declare methods and properties under the same public section.

Regards
0
 
LVL 1

Author Comment

by:peterkiers
ID: 24772357
OK.
0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 24823199
i changed published to public

you can declare private, protected, public, published as many times as you like

this is usually done when in test or draft stage
afterwards the sections are combined when doing code cleanup
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question