[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 386
  • Last Modified:

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

0
Asw
Asked:
Asw
1 Solution
 
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
 
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

Featured Post

[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now