Autor Beitrag
Dragonclaw
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Sa 20.01.07 12:30 
Hallo,

ich versuche gerade einen MatheParser für GanzRationale Funktionen zuschreiben. Soweit klappt das auch ganz gut, nur schein ich jetzt gegen eine Wand zu rennen.

Das Problem ist folgendes, wenn ich mein Projekt compilieren will kommt dieser Fehler:

ausblenden Quelltext
1:
[Fehler] Unit1.pas(47): Undefinierter Bezeichner: 'Parameter'#					


Und zwar zeigt Delphi an das der Fehler in der makierten Zeile vorliegt.

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
  private
    Funktion: String;
    XWert: Real;
    Parameter: Array[1..10] of Real;
    function WertY(WertX: Real):Real;
   { Private-Deklarationen }
  public
   { Public-Deklarationen }
  end;

//...

function WertY(WertX:Real):Real;
var I : Integer;
begin
for I := 10 downto 1 do
 Result := Result + (Parameter[I] * Power(WertX,I));
end;


Weiß jemand warum dieser Fehler kommt,bzw. was ich falsch machen?

Vielen Dank im Vorraus
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Sa 20.01.07 12:32 
soweit ich weiß müssen alle in einer Funktion verwendeen Variablen in der Funktion deklariert werden

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Dragonclaw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Sa 20.01.07 12:49 
user profile iconLeuchtturm hat folgendes geschrieben:
soweit ich weiß müssen alle in einer Funktion verwendeen Variablen in der Funktion deklariert werden


Wie meinst du das? Parameter soll eingentlich ein Array sein was auserhalb der Funktion gefüllt wird.
jakobwenzel
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1889
Erhaltene Danke: 1

XP home, ubuntu
BDS 2006 Prof
BeitragVerfasst: Sa 20.01.07 12:52 
Die Funktion gehört nicht zu der Klasse da oben, weil nicht der Klassenname davorsteht.

_________________
I thought what I'd do was, I'd pretend I was one of those deaf-mutes.
Dragonclaw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Sa 20.01.07 12:59 
Okay jetzt versteht ich wirklich nur noch Bahnhof. Was genau meinst du?
Leuchtturm
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1087

Win Vista, Knoppix, Ubuntu
Delphi 7 Pe, Turbo Delphi, C#(VS 2005 Express), (X)HTML + CSS, bald Assembler
BeitragVerfasst: Sa 20.01.07 13:31 
sowas wie:
ausblenden Delphi-Quelltext
1:
function TForm1.WertY(WertX:Real):Real;					

_________________
Ich bin dafür verantwortlich was ich sage - nicht dafür was du verstehst.
Grenzgaenger
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Sa 20.01.07 13:32 
deine funktion kennt den parameter nicht, musst ihn also einführen... da gibts mehrere möglichkeiten, du nimmst die funktion in deine klasse, du definierst 'ne globale variable oder du gibst sie als parameter mit... bspw. so

ausblenden Delphi-Quelltext
1:
function WertY(WertX:Real; parameter: pointer):Real;					


<HTH>
Dragonclaw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Sa 20.01.07 13:34 
user profile iconLeuchtturm hat folgendes geschrieben:
sowas wie:
ausblenden Delphi-Quelltext
1:
function TForm1.WertY(WertX:Real):Real;					



Okay das wars.... Vielen herzlichen Dank.
ssb-blume
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 375
Erhaltene Danke: 7

XP, W7, W8
Deutschland
BeitragVerfasst: Sa 20.01.07 17:43 
Die Funktion muß als Klassenbestandteil auch so aufgerufen werden:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
//type classname ??

function classname.WertY(WertX:Real):Real;
//..

_________________
Brain: an apparatus with which we think we think.
Dragonclaw Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 196

Windows Vista
Delphi 7 Prof.
BeitragVerfasst: Sa 20.01.07 17:53 
Das weiß ich normalerweise auch, nur manch mal sieht man halt den Baum vor lauter Wald nicht.