Forum > LCL

How can I override methots in my class?

(1/1)

BlueIcaro:
Hello, I have a class like this:


--- Quote ---Type tMyClass = Class
   Private
    (...)
   Public
      Constructor Create;
      Procedure Blabla;
end;
--- End quote ---

Well, with this I have a Class, and I can write:


--- Quote ---  MiClase := TMyClass.Create;
  MiClase.Blaba;

--- End quote ---

But How Can I override the constructor, and the procedure, and have some thing like this:


--- Quote ---  Constructor Create (Param1:String);
  Procedure Blabla (Param : Integer);
--- End quote ---

I know, this you can do it in C#, but I want How can I do in FreePascal?

Thanks
/BlueIcaro

JuhaManninen:
Just add "overload;" keyword to the end of functions with same name but different parameter signature.

Juha

BlueIcaro:

--- Quote from: JuhaManninen on September 21, 2010, 05:38:51 pm ---Just add "overload;" keyword to the end of functions with same name but different parameter signature.

Juha


--- End quote ---

Thank you, it's works!!  :D

Well, Now I think it was fool question, I need read more Object Pascal  :-[

/BlueIcaro

Leledumbo:
Just want to correct your term, it's overloading, not overriding.

Navigation

[0] Message Index

Go to full version