|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Unexpected behaviour of MyClass (please ignore 1st post)Public Class Base
Public Function Foo() As String Return MyClass.GetType.FullName End Function End Class Public Class Derrived Inherits Base End Class Why does Derrived.Foo() return "Derrived"? Shouldn't that be "Base"? "Diana Mueller" <no@spam> schrieb: If you instantiate 'Derived' and call 'Foo' on this object, the object's > Public Class Base > Public Function Foo() As String > Return MyClass.GetType.FullName > End Function > > End Class > > Public Class Derrived > Inherits Base > End Class > > Why does Derrived.Foo() return "Derrived"? Shouldn't that be "Base"? most specific type is 'Derived', and thus "Derived" is returned. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> Diana,
Because you are doing a methnod which is in MyClass which returns the type of the current instance and not from the used class Than it would have been Gettype(Base).FullName I hope this helps, Cor
Dragging a mail from Outlook/Outlook Express in to a .NET VB app
DataGrid Bind to DataSet, then Bind to DaTaview, GOT ERROR...PLS HELP File pointer to be positioned at the last occurance of a keyword Lines and Boxes in VB.Net Newbie VB Question MDIChild form controls: how to pass information between them? Bound combo box problem Connectionstring Copy Directry including across the Volumes. Datagrid checkbox question |
|||||||||||||||||||||||