Hello everyone !!
After a long, long time of using GPC I began to write Object related programs. I did so at school (MacIntosh, ThinkPascal :-( ) and now I want to port my programs onto my Linux box. However here is a first error, of which I don't really know how to get around it. I think it's just an Syntax error concerning the two pascal dialects. Perhaps someone could send me a correction of it, that is compilable with GPC ?
Here is my shortened program :
program foo;
type something = object procedure say_hello; end;
procedure something.say_hello; begin writeln('Hello !'); end;
var someone : something;
begin new(someone); someone.say_hello; dispose(someone); end.
And now, this is what GPC cries about : foo.p: In function `program_Foo': foo.p:16: pointer type required for `New' foo.p:18: pointer type required for `Dispose'
I thought if I declare 'someone' as an object of the class 'something' it is automatically a pointer onto a structure of this class. Obviuosly I am wrong.
Help would be great !
On Mon, 9 Mar 1998, Christian Bockermann wrote:
[...] type something = object procedure say_hello; end; [...] var someone : something; [...] new(someone); someone.say_hello; dispose(someone); [...]
The above reason is why, you're trying to allocate memory to a non-pointer. You need to define a type that is a pointer to the object something, perhaps the following:
type psomething = ^something; something = object ... end;
and then declare someone to psomething instead of something so you can use New and Dispose.
See ya! Orlando Llanes
"Meine Damen und Herren, Elvis hat soeben das Gebaeude verlassen!"
"Look out fo' flyeeng feet" O__/ a010111t@bc.seflin.org /|____. O <__. /> / \ ____________|_________ http://ourworld.compuserve.com/homepages/Monkey414