Inheritance

C

coco343

Hello,
How can i call the parent function, in a child shared shadows
function ?
MyBase, MyClass and Me, are not allowed.

Here a exemple :

Public Class MyBaseClass

Public Shared Function MyFunction() As T
'code
End Function

End Class

Public Class MyChildClass
Inherits MyBaseClass

Public Shared Shadows Function MyFunction() As T
'here, how can i call the parent function ?
End Function

End Class
 
R

rowe_newsgroups

Hello,
How can i call the parent function, in a child shared shadows
function ?
MyBase, MyClass and Me, are not allowed.

Here a exemple :

Public Class MyBaseClass

Public Shared Function MyFunction() As T
'code
End Function

End Class

Public Class MyChildClass
Inherits MyBaseClass

Public Shared Shadows Function MyFunction() As T
'here, how can i call the parent function ?
End Function

End Class

MyBaseClass.MyFunction()

Shared (static in C#) members can't be overriden, so the method is
still going to be accessed just like it normally would be. IMO having
to specify "Shadows" on the shared method in the child class is just a
"do you know that you're shadowing and not overloading" message from
the compiler.

Thanks,

Seth Rowe
 
C

coco343

MyBaseClass.MyFunction()

Shared (static in C#) members can't be overriden, so the method is
still going to be accessed just like it normally would be. IMO having
to specify "Shadows" on the shared method in the child class is just a
"do you know that you're shadowing and not overloading" message from
the compiler.

Thanks,

Seth Rowe- Masquer le texte des messages précédents -

- Afficher le texte des messages précédents -

thanks :)

i though we can call it directly, as the child class inherits it.
i use shadows, because i can't use overrides ...
 
P

Parag Joshi

Since its a shared function you cannot call it with an instance variable.
Use syntax Mybaseclass.MyFunction.
Regards
Parag
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top