Warning on procedure.

Hi Guy's,

When I compile my code I get a warning
that method 'Update' hides virtual method of base type 'TWincontrol'.

Public     procedure Update;

procedure TFormMain.Update;
Label1.Caption := HaHaHa' ;

Why do I have a warning.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You get the warning because the method in the ancestor class is declared as virtual. Your declaration has redeclared the function so that calling Update in the ancestor classes will not call your implementation of Update, but the 'last' declared overridden version of it.

You should probably declare it like this (unless this is the behaviour you want):

Public     procedure Update; Override;



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Asw, I guess you just thought about a good fitting name for your method and found that "Update" sounds okay. The problem is that "Update" is already in use, thus the warning. So either choose a different name (one that is not in use yet).
If I've mistaken your intention and what you want to do is change the behaviour of this already defined "Update" method, then you should do as Raymond suggested and use the "override" keyword.

Regards, Madshi.
AswAuthor Commented:
hi Raymond, Madshi,

Thanks for your help you are both correct but I have to give the points to some guy so I think it is fair to give to the first answer.

Many Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.