TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Will Young
NA
1
3k
Problems converting from derived to base class
Nov 4 2010 5:38 PM
I am trying to convert from a derived class to a base class and it kind of works. Is there a way to get it to really work. Take the following example:
Class A
Public Description as String
End Class
Class B
Inherits A
End Class
Function Test() As String
Dim myB As B
Dim obj As Object
myB = New B()
obj = CType(myB, A)
return obj.GetType.ToString
End Function
In this case the tostring comes back as B not A. For all other purposes it works, but it isn't actually converting it to class A. This is only a problem because I have some Override methods I'm employing.
Any insight would be much appreciated. I'm using VB.NET 2008 for reference. Thanks.
Reply
Answers (
0
)
Help Capturing F5 KeyPress
Date control