1
votes

I have the following code in Object Oriented Turbo Pascal (an example). And also, some questions for you guys, who have the knowledge of Turbo Pascal - because I can't find any answers.

type PMyNumber =^TMyNumber;
     TMyNumber = object(TObject)
                 Number1:real;
                 Number2:real;
                 constructor Init(x,y:real);
                end;

Question #1

I see code like new(PMyNumber,Init(-4,0)) - is it some type of an object constructor ?


Question #2

someVariable := PMyNumber(MyColl[myIndex]^.At(j))^.Number1

I try to view the value of the MyColl[myIndex]^.At(j). To do so, I open the Evaluate/modyfy window, but after click on Evaluate button, the I get the following error - what's wrong ?

enter image description here

moreover (I don't think the ) char is needed here:

enter image description here


Question #3

how to read the pointer variable value ?

enter image description here

1

1 Answers

0
votes
  1. Yes, Init() is the name of the constructor.

  2. You cannot evaluate a function call (At() is a member function of TMyNumber inherited from TObject).

  3. If mean how to interpret the Pascal pointer notation: a leading '$' means hexadecimal value. The first value ($888F) is the segment and the second value ($8) is the offset within the segment. (Assuming you understanding the concept segments in a 16-environment.) If you mean how to read the value of a pointer at runtime: Use seg() to get the segment and ofs() to get the offset, like seg(MyColl[myindex]) and ofs(MyColl[myindex]).