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;
begin
Label1.Caption := HaHaHa' ;

Why do I have a warning.

Asw

LVL 1
AswAsked:
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.

rwilson032697Commented:
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;

Cheers,

Raymond.
0

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
MadshiCommented:
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.
0
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
Andy
0
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
Delphi

From novice to tech pro — start learning today.