Solved

Can Public be declared more than once.

Posted on 2009-07-03
3
143 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Machine not responding during CopyFile() 3 89
Delphi TcxGrid group footer summary 3 211
Dev express lookupcombo 3 13
update joined tables 2 31
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now