Click here to Skip to main content
15,889,595 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Having a Hard Time with If Pin
Luc Pattyn7-Aug-09 3:50
sitebuilderLuc Pattyn7-Aug-09 3:50 
AnswerRe: Having a Hard Time with or without If Pin
Luc Pattyn7-Aug-09 0:51
sitebuilderLuc Pattyn7-Aug-09 0:51 
GeneralRe: Having a Hard Time with or without If Pin
Bob Beaubien7-Aug-09 2:58
Bob Beaubien7-Aug-09 2:58 
Answerhave you tried the debugger ? Pin
David Mujica7-Aug-09 3:49
David Mujica7-Aug-09 3:49 
Questionhow to add Math library? Pin
zhiyuan166-Aug-09 16:02
zhiyuan166-Aug-09 16:02 
AnswerRe: how to add Math library? Pin
Scott Dorman6-Aug-09 18:14
professionalScott Dorman6-Aug-09 18:14 
Question[Message Deleted] Pin
Cece26-Aug-09 10:52
Cece26-Aug-09 10:52 
AnswerRe: What is the error in these codes? Some body please help me...Please Pin
Adam R Harris6-Aug-09 11:32
Adam R Harris6-Aug-09 11:32 
Well for 1, if all these classes are in the same namespace you wont be able to compile.

You can't have multiple classes with the same name in any namespace (except with partial classes ... but those are really only one class spread over multiple files).

You have declared the Hello class 3 times, that is not even close to valid.

2nd;

in all your classes you override your function 'hi' with a different signature than the one defined in Hello. A signature is a combination of the name of the function and the parameters it expects. For your 'hi' function in [Hello] you declared it as not expecting any parameters, the in your inherited classes you are trying to override it with a function that expects a string as a parameter.

You should really read this article[^] to help you understand inheritance because it seems like your not totally understanding it.

so your code should look something like this; (Probably wont compile because my VB is very rusty)

public mustinherit class Hello
  'What you had
  public MustOverride Function hi() as string
  'What i added because you were trying to override this without having it
  public MustOverride Function hi(byVal name as String) as string
end class

public class NorthEasterner
  inherits Hello

  'this HAS to be overriden because its declared as 'MustInherit'
  public Overrides Function hi() as String
    'No name was passed in so just welcome the stranger
    return "Hello Stranger"
  end function

  'this HAS to be overriden because its declared as 'MustInherit' 
  public Overrides Function hi(ByVal name as String) as String
    return "How ya doin," & name
  end function

end class

public Class DragRacer
  Inherits Hello
  
  'this HAS to be overriden because its declared as 'MustInherit' 
  Overrides Function Hi() As String
    Return "Start your engines!"
  End Function 

  'this HAS to be overriden because its declared as 'MustInherit' 
  public Overrides Function hi(ByVal name as String) as String
    return "Start your engines " & name & "!"
  end function

End Class

public Class Euro
  Inherits Hello

  'this HAS to be overriden because its declared as 'MustInherit' 
  Overrides Function Hi() As String
    Return "Caio"
  End Function

  'this HAS to be overriden because its declared as 'MustInherit' 
  public Overrides Function hi(ByVal name as String) as String
    return "Caio " & name
  end function

End Class


You could put all of these classes in separate code files, just make sure they are all in the same namespace and your golden. By default all of the code files you add should share the 'Default Namespace' defined in the project properties dialog.

If at first you don't succeed ... post it on The Code Project and Pray.

General[Message Deleted] Pin
Cece26-Aug-09 11:46
Cece26-Aug-09 11:46 
GeneralRe: What is the error in these codes? Some body please help me...Please Pin
Luc Pattyn6-Aug-09 11:51
sitebuilderLuc Pattyn6-Aug-09 11:51 
GeneralRe: What is the error in these codes? Some body please help me...Please Pin
Adam R Harris6-Aug-09 11:53
Adam R Harris6-Aug-09 11:53 
AnswerRe: What is the error in these codes? Some body please help me...Please Pin
riced6-Aug-09 23:42
riced6-Aug-09 23:42 
Question[Message Deleted] Pin
Dambod6-Aug-09 4:44
Dambod6-Aug-09 4:44 
AnswerRe: any help to clear datagridview data when combobox.selecteditem changes Pin
dan!sh 6-Aug-09 8:57
professional dan!sh 6-Aug-09 8:57 
Questionemploye information Pin
vinayak more6-Aug-09 2:42
vinayak more6-Aug-09 2:42 
AnswerRe: employe information Pin
Johan Hakkesteegt6-Aug-09 3:10
Johan Hakkesteegt6-Aug-09 3:10 
AnswerRe: employe information Pin
Dalek Dave6-Aug-09 3:26
professionalDalek Dave6-Aug-09 3:26 
AnswerRe: employe information Pin
Luc Pattyn6-Aug-09 4:01
sitebuilderLuc Pattyn6-Aug-09 4:01 
AnswerRe: employe information Pin
Ashfield6-Aug-09 8:46
Ashfield6-Aug-09 8:46 
AnswerRe: employe information Pin
Steven J Jowett6-Aug-09 9:54
Steven J Jowett6-Aug-09 9:54 
AnswerRe: employe information Pin
Henry Minute6-Aug-09 10:22
Henry Minute6-Aug-09 10:22 
Questioncalculate start and stop time Pin
KannanNatesan6-Aug-09 2:32
KannanNatesan6-Aug-09 2:32 
AnswerRe: calculate start and stop time Pin
Johan Hakkesteegt6-Aug-09 3:10
Johan Hakkesteegt6-Aug-09 3:10 
GeneralRe: calculate start and stop time Pin
Dalek Dave6-Aug-09 3:27
professionalDalek Dave6-Aug-09 3:27 
GeneralRe: calculate start and stop time Pin
Luc Pattyn6-Aug-09 4:19
sitebuilderLuc Pattyn6-Aug-09 4:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.