Create virtual method out of a virtual method

  • Thread starter Thread starter A.Bekiaris
  • Start date Start date
A

A.Bekiaris

Hi

I have an abstract class with some virtual methods which I inherit and create say Class1 I want to give end users the ability to override the virtual methods of the base class

How this can be implemented?



thnks
 
A.Bekiaris said:
I have an abstract class with some virtual methods which
I inherit and create say Class1 I want to give end users the
ability to override the virtual methods of the base class
How this can be implemented?

If you use 'virtual' instead of 'override', then your overridden
methods can be overridden themselves. Is that what you mean?

P.
 
Thnks Paul that was it
But still the compiler gives the warning
“To make the current member override that implementation add the
override keyword. Otherwise add the new keyword”
I wonder if there is a better way
 
If you use 'virtual' instead of 'override', then your overridden methods
can be overridden themselves. Is that what you mean?

No, that's incorrect. A method marked with the keyword virtual is never an
override, it's a new method that can be overridden.

To get the expected behaviour, just use override. A method marked
with the override keyword is implicitly virtual and can be overridden.

- Magnus
 
Back
Top