[fpc-pascal]WoW
Shifted Soul
snsii at yahoo.fr
Fri Aug 17 20:00:30 CEST 2001
Lets see this code :
PROGRAM Essai;
{$MODE OBJFPC}
TYPE
a = CLASS
PUBLIC
CONSTRUCTOR a1;
x : Integer;
DESTRUCTOR a2;
END;
CONSTRUCTOR a.a1;
BEGIN
END;
DESTRUCTOR a.a2;
BEGIN
END;
VAR
b : a;
BEGIN
b.x := 10;
write(b.x);
END.
As I learned in the documentation, b is a pointer that is not allocated
:
"Remember that a class is a pointer to an object, so when you declare a
variable of some class, the compiler just allocates a pointer, not the
entire object."
documentation : Reference guide : Classes
then why this code is functional ?!
This is my problem : I am using a pointer which not allocated (Am I
using a ghost memory ???!).
Please tell what's the problem (it is a bug ?).
Shifted Soul
More information about the fpc-pascal
mailing list