|
-
May 5th, 2002, 02:03 PM
#1
Thread Starter
New Member
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
-
May 5th, 2002, 04:16 PM
#2
Frenzied Member
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.
-
May 5th, 2002, 09:55 PM
#3
Addicted Member
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.
That which does not kill us, only makes us stronger. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|