Jump to content
TroisVerites

Class or Object with SCAR

Recommended Posts

Hi

 

I know Freddy has a plan SCAR 4.00.

 

But I would like to know if there is a solution with Record. When you define a function or procedure , how to access to the data ( NumVal , Values in the sample) ?

 

I have plenty questions what I can do with Scar and what I can not do.

 

Perhaps Freddy can tell me. What is the limitation about SCAR.

 

Thanks

 


Type
 Average = Record
   NumVal: Integer;
   Values: Array [1..200] of integer;
   Mean : function(): integer; { calculates the average value of the array }
   WriteLn : procedure (s: string);
 End;

var
   Avg : Average;

begin
   Avg.Mean();
   Avg.WriteLn('tot');
end.

Link to comment
Share on other sites

You can not do the procedures directly in a Record. But everything else works fine. Use @, at symbol to access data. Its just like in Delphi.

 

SCAR does not support classes, or records with functions in them. However with the functions you can indirectly use them, but I don't think its worth messing with.

 

But SCAR does have built in classes. An object is a variable of a class.

Edited by LordJashin
Link to comment
Share on other sites

HI Lord

 

Can you show a sample ? with @ to acess data

 

Thanks

 

He means that you have to store the procedures in the record using the @ operator.

 

AvgVariable.WriteLn := @WriteLn; for example

 

There's no way to access the data in the record directly from a function pointer.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...