[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

vb syntax question 1

Hello all,

  My boss is doing a fun little VB quiz with 3 questions to all of his C# programmer teams and the winner gets lunch on him. :)  I would love to have a steak lunch today so any assistance would be appriciated.

He has given us some code and wants us to find the errors I will post below what I have and what I believe is wrong if you could verrify that would be great

Qustion 1

Public Class hello

Function Hi() As String

Return "Hey"

End Function

End Class


' I cant find anything wrong with this code other than the fact that there is no imput for the

' function to access i.e. button press


Question 2

Class Hello2

MustOverride Function Hi() As String

Return "hi!"

End Function

End Class

' In this code I have found 2 errors

' error 1 the class hello2 should be declared mustinherit because it contains methods mustoverride

' error 2 shouldent Endfunction be mustoverride end function or am I wrong


Question 3

Class hello3

MustInherit Function Hi() As String


End Class

Class Gentleman

Inherits hello3

Overrides Function Hi() As String

Return "Good Day"

End Function

End Class

'' should the MustInherit be taken out and it be left as Function Hi() As String

'' Overrides function Hi can not overide because the function is not defined as overridable correct?

  • 2
1 Solution
Q1: No modifier on function (public/private/friend)
Q2: Your point 1 is correct. Point 2 no.
Q3: MustInherit applies to class not function.
HawaiiDragonAuthor Commented:
Myself and 5 others thank you!!!!
So you got the lunch then?

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now