By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,815 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,815 IT Pros & Developers. It's quick & easy.

About OO in VB

P: n/a
ABC
I have one base class (A) and a derived class (B)

Class A
...
...
...
Public Overrides Function GetText() as string
Return "A" & _text
end function

Public Function GetFormatText() as string
a = GetText()
End function
end class

Class B Inherits A
Public Overrides Function GetText() as string
Return "B" & _text
end function
End Class
When I call B.GetFormatText(), it return like as "A....." not my expected
"B....."

How can I fix it?
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
ABC,

Strange this returns for me "B".

(Maybe can you make next time an error free sample)

\\\
Class A
Public Overridable Function GetText() As String
Return "A"
End Function
Public Function GetFormatText() As String
Return GetText()
End Function
End Class
Class B
Inherits A
Public Overrides Function GetText() As String
Return "B"
End Function
End Class
///

I hope this helps,

Cor

"ABC" <abc.abc.com> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have one base class (A) and a derived class (B)

Class A
...
...
...
Public Overrides Function GetText() as string
Return "A" & _text
end function

Public Function GetFormatText() as string
a = GetText()
End function
end class

Class B Inherits A
Public Overrides Function GetText() as string
Return "B" & _text
end function
End Class
When I call B.GetFormatText(), it return like as "A....." not my expected
"B....."

How can I fix it?

Nov 21 '05 #2

P: n/a
ABC
Thank you.
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
ABC,

Strange this returns for me "B".

(Maybe can you make next time an error free sample)

\\\
Class A
Public Overridable Function GetText() As String
Return "A"
End Function
Public Function GetFormatText() As String
Return GetText()
End Function
End Class
Class B
Inherits A
Public Overrides Function GetText() As String
Return "B"
End Function
End Class
///

I hope this helps,

Cor

"ABC" <abc.abc.com> schreef in bericht
news:%2****************@TK2MSFTNGP10.phx.gbl...
I have one base class (A) and a derived class (B)

Class A
...
...
...
Public Overrides Function GetText() as string
Return "A" & _text
end function

Public Function GetFormatText() as string
a = GetText()
End function
end class

Class B Inherits A
Public Overrides Function GetText() as string
Return "B" & _text
end function
End Class
When I call B.GetFormatText(), it return like as "A....." not my expected
"B....."

How can I fix it?


Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.