Changing Inherited Implementations

Descendant classes can change the way a specific interface method is implemented by overriding the implementing method. This requires that the implementing method be virtual or dynamic.

A class can also reimplement an entire interface that it inherits from an ancestor class. This involves relisting the interface in the descendant class' declaration. For example, type

IWindow = interface

['{00000115-0000-0000-C000-000000000146}'] procedure Draw;

end;

TWindow = class(TInterfacedObject, IWindow)// TWindow implements IWindow procedure Draw;

end;

TFrameWindow = class(TWindow, IWindow)// TFrameWindow reimplements IWindow procedure Draw;

end;

Reimplementing an interface hides the inherited implementation of the same interface. Hence method resolution clauses in an ancestor class have no effect on the reimplemented interface.

Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook


Post a comment