Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can I overload override methods/properties?
Message
De
12/01/2005 11:49:22
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00976420
Message ID:
00976444
Vues:
10
No problem, Einar. And they're not silly questions. I remember thinking way back when that it seemed stupid to me that you couldn't overload the return data type ... but, that's the way it is. I think it has something to do with how it works internally ... I knew the reason at one time, but I've forgotten it (early Alzheimer's <g>).

~~Bonnie




>Bonnie,
>Thank you for your reply.
>I guess I must have misunderstood overloading. I thought you could overload a method by having the same parameters but different return values. Like this:
>
>private void myM()
>{
>	MessageBox.Show("Void");
>}
>private int myM()
>{
>	MessageBox.Show("int");
>	return (int)50;
>}
>
>but that is not the case, and I guess it makes sense after thinking a little about it <s>.
>
>Again thank you for taking the time to answer my (silly <s>) question.
>
>Sincerely,
>Einar
>
>
>
>>First, I don't see how you could overload a property. You can overload anything by specifying different parameters, but you cannot overload by specifying a different return data type. Since there are no parameters with a property, you can't overload it.
>>
>>Secondly, you wouldn't actually be overloading an overridden method ... if that method does not already have that particular signature, you couldn't override it. You'd just be creating a new method with a different signature without the override part.
>>
>>IOW, you can't say:
>>
>>public override MyMethod(DifferentParms)
>>
>>you'd just have
>>
>>public MyMethod(DifferentParms)
>>
>>Does this make sense?
>>
>>~~Bonnie
>>
>>
>>>I have attempted to overload an override property and apparently that is not possible (compiler error). Is this correct?
>>>I have not tried it yet but I assume it is possible to overload an overridden method. Please confirm.
>>>
>>>Einar
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform