-
Overload properties
Hi all,
I've got a problem overloading properties and I don't know why!
If I need the same property with different arguments VB.NET let me do
1)
Public Property A() As Integer
Public Property A(ByVal b As Boolean) As Integer
Public Property A(ByVal c As String) As Integer
2)
Public Override Property A() As Integer
Public Override Property A(ByVal b As Boolean) As Integer
Public Override Property A(ByVal c As String) As Integer
These two syntaxes are the same?
Why if I call Class1.A() from a C# code sometimes I get just A() or A(b) or A(c), sometimes A(), A(b) and A(c) (how I expect!) and sometimes I must call the internal name get_A()/set_A(), get_A(b)/set_A(b)...
This is too strange to me!
Cya
-
Don't completely understand the question.
Class2 should be inherting Class1. Also, in class one you should use the syntax to let the compiler know that property X is overridable using the "Overridable" keyword.
-
I don't understand the question either, but another possibility is...
When you override a method from a base class in a derived class. The type of object you create will determine which class you actually call. If you create a base class object, you will call the base class method. If you create a derived class object, you will call the derived class method.
This may or may not be what you're looking for, but I took a shot.:D