sherbug1015
asked on
Using a non abstract function
I have an abstract class that has 2 abstract methods and 1 non abstract method. I have created a derived class and I need to call the non abstract method and i don't seem to be able to access it.
How do I call a non abstract method in an abstract class from the derived class.
Thanks for your help.
How do I call a non abstract method in an abstract class from the derived class.
Thanks for your help.
ASKER
Here is an example of what I have:
Public MustInherit Class AbstractClass
Public Function AddTwoNumbers(Num1 As Integer, Num2 As Integer) As Integer
Return Num1 + Num2
End Function
Public MustOverride Function MultiplyTwoNumbers(Num1 As Integer, Num2 As Integer) As Integer
End Class
This is the Derived Class
Public Class DerivedClass2
Inherits AbstractClass
Public Overrides Function MultiplyTwoNumbers(Num1 As Integer, Num2 As Integer) As Integer
End Function
End Class
How do I call the AddToNumbers Function from the derived class.
Public MustInherit Class AbstractClass
Public Function AddTwoNumbers(Num1 As Integer, Num2 As Integer) As Integer
Return Num1 + Num2
End Function
Public MustOverride Function MultiplyTwoNumbers(Num1 As Integer, Num2 As Integer) As Integer
End Class
This is the Derived Class
Public Class DerivedClass2
Inherits AbstractClass
Public Overrides Function MultiplyTwoNumbers(Num1 As Integer, Num2 As Integer) As Integer
End Function
End Class
How do I call the AddToNumbers Function from the derived class.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Make sure that the accessor is not private for the method so that it is available to sub-classes.