Le Jul 30, 2008 à 10:37 PM, Lourival Mendes a écrit :

I would do something like this:


C
----------------------------
struct product {
 int weight;
 float price;
} ;

product apple;
-----------------------------

Pascal
----------------------------
Type
  product = record
     weight: Integer ;
     price: double;
   end;

Var
 apple: product ;
----------------------------

This is the reason that I do believe that is missing something on the code:

struct a;



A C-struct is merely a record. A struct with methods is a class.

struct Foo
{
    Foo() : tag(0) {}
    int tag;
    void compute() {...}
};

would be

class Foo
private
  FTag: Integer;
public
  constructor Create;
  procedure compute;
  property tag: Integer read FTag write FTag;
end;

the property is not really needed of course.


--
Damien Gerard
[EMAIL PROTECTED]

Si ces robots s'humanisaient, inversement les êtres humains se robotiseraient-ils ?








_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to