If class A has a virtual method and then class B which is subclasses A, overrides that method. Then class C subclasses B. So now C is supposed to inherit B's overriden method, and not A's virtual method. Then if C wants to override B's one it can't because B's method can't be both virtual and override. I guess all inherited classes inherit virtual method from the grand-parent node in object graph in this case and not their parent node. But this seems counter-intuitive. Someone is supposed to inherit something from the parent not grandparent.

If class A has a virtual method and then class B which is subclasses A, overrides that method. Then class C subclasses B. So now C is supposed to inherit B's overriden method, and not A's virtual method. Then if C wants to override B's one it can't because B's method can't be both virtual and override. I guess all inherited classes inherit virtual method from the grand-parent node in object graph in this case and not their parent node. But this seems counter-intuitive. Someone is supposed to inherit something from the parent not grandparent.

From the Programming Police:

You cannot use the virtual modifier with the following modifiers:

static abstract override

BUT! A virtual inherited property can be overridden in a derived class by including a property declaration that uses the override modifier.

SOURCE


If this answers your question, please mark the thread as solved. Happy programming!

Edited 6 Years Ago by Zinderin: n/a

This article has been dead for over six months. Start a new discussion instead.