vb syntax question 1

Posted on 2011-05-13
Last Modified: 2012-05-11
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?

Question by:HawaiiDragon
    LVL 83

    Accepted 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.

    Author Comment

    Myself and 5 others thank you!!!!
    LVL 83

    Expert Comment

    So you got the lunch then?

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now