AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

access private procedures

Ein Thema von question · begonnen am 21. Jul 2013 · letzter Beitrag vom 21. Jul 2013
Antwort Antwort
question

Registriert seit: 17. Apr 2013
97 Beiträge
 
#1

access private procedures

  Alt 21. Jul 2013, 20:06
Hello,
I have created a projectgroup , in this projectgroup- i have two units. I have created one procedure in unit under private declaration and I would like to call this procedure from another unit. But I have an error “cannot access private symbol…”
Could you please tell me, how to access private Procedures/Function from one unit to another ?
Here is the code:

unit CalCulation;
interface
uses
type
TCal = class(TObject)
private
procedure AddNumbers (Sender : TObject);
end;
var
MyAdd : TCal;
implementation
procedure TCal. AddNumbers (Sender : TObject);
var
t,o, Result : integer;
begin
//calculation
end;
------------------------------
unit frmShow;

procedure TForm3.Button1Click(Sender: TObject);
begin
MyAdd.AddPublic(Sender); // here is the error as it has declared as a private in other unit
end;
  Mit Zitat antworten Zitat
Benutzerbild von Union
Union

Registriert seit: 18. Mär 2004
Ort: Luxembourg
3.487 Beiträge
 
Delphi 7 Enterprise
 
#2

AW: access private procedures

  Alt 21. Jul 2013, 20:17
Make them public. AND TAG YOUR SOURCE.
Ibi fas ubi proxima merces
sudo /Developer/Library/uninstall-devtools --mode=all
  Mit Zitat antworten Zitat
Der schöne Günther

Registriert seit: 6. Mär 2013
6.110 Beiträge
 
Delphi 10 Seattle Enterprise
 
#3

AW: access private procedures

  Alt 21. Jul 2013, 21:10
Why did you make it private then? Private means private.

There is, however, a rather ugly way: You can declare a new subclass in your new unit and cast your object to that new subclass.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 18:58 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz