Click here to Skip to main content
15,894,343 members
Home / Discussions / C#
   

C#

 
GeneralRe: About TreeNode Pin
Paul Sun29-May-05 16:31
Paul Sun29-May-05 16:31 
GeneralRe: About TreeNode Pin
mav.northwind29-May-05 21:30
mav.northwind29-May-05 21:30 
Generalquestion regarding "SerializationInfo" parameter in the serialization function Pin
Green Fuze29-May-05 15:49
Green Fuze29-May-05 15:49 
GeneralDumb plus Pin
Niklas Ulvinge29-May-05 5:46
Niklas Ulvinge29-May-05 5:46 
GeneralRe: Dumb plus Pin
DavidNohejl29-May-05 12:22
DavidNohejl29-May-05 12:22 
GeneralRe: Dumb plus Pin
Niklas Ulvinge30-May-05 2:37
Niklas Ulvinge30-May-05 2:37 
GeneralRe: Dumb plus Pin
S. Senthil Kumar30-May-05 3:47
S. Senthil Kumar30-May-05 3:47 
QuestionCovariant return types? Pin
S. Senthil Kumar29-May-05 4:12
S. Senthil Kumar29-May-05 4:12 
Does someone know why C# doesn't have covariant return types?

All I want to do is this
class GeneralItem
{
   public abstract object GetContents();
}

class StringItem : GeneralItem
{
    public override string GetContents()
    {...}
}

I get a compiler error saying it doesn't like return types of overridden methods to be different. It's legal in C++, so why is it not available in C#?

The workaround suggested is to provide an explicit interface implementation, but I don't have one defined already. Defining a new interface just doesn't seem right.

It isn't available in C# 2.0 either. Any idea why?

Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
AnswerRe: Covariant return types? Pin
Niklas Ulvinge29-May-05 5:19
Niklas Ulvinge29-May-05 5:19 
GeneralRe: Covariant return types? Pin
S. Senthil Kumar29-May-05 5:26
S. Senthil Kumar29-May-05 5:26 
GeneralRe: Covariant return types? Pin
Niklas Ulvinge29-May-05 5:29
Niklas Ulvinge29-May-05 5:29 
GeneralRe: Covariant return types? Pin
S. Senthil Kumar29-May-05 5:45
S. Senthil Kumar29-May-05 5:45 
GeneralRe: Covariant return types? Pin
Niklas Ulvinge29-May-05 5:50
Niklas Ulvinge29-May-05 5:50 
GeneralRe: Covariant return types? Pin
S. Senthil Kumar29-May-05 19:27
S. Senthil Kumar29-May-05 19:27 
AnswerRe: Covariant return types? Pin
Christian Graus29-May-05 12:28
protectorChristian Graus29-May-05 12:28 
GeneralRe: Covariant return types? Pin
S. Senthil Kumar29-May-05 19:23
S. Senthil Kumar29-May-05 19:23 
GeneralRe: Covariant return types? Pin
FriendlyFiend29-May-05 20:19
FriendlyFiend29-May-05 20:19 
GeneralRe: Covariant return types? Pin
S. Senthil Kumar29-May-05 20:47
S. Senthil Kumar29-May-05 20:47 
AnswerRe: Covariant return types? Pin
Kevin McFarlane30-May-05 1:47
Kevin McFarlane30-May-05 1:47 
GeneralRe: Covariant return types? Pin
S. Senthil Kumar30-May-05 3:45
S. Senthil Kumar30-May-05 3:45 
GeneralRe: Covariant return types? Pin
Kevin McFarlane30-May-05 4:39
Kevin McFarlane30-May-05 4:39 
QuestionHow to use texture bar in AxMSChart Pin
luckyeagle29-May-05 3:52
luckyeagle29-May-05 3:52 
GeneralCustom Control Woes Pin
notacake29-May-05 3:12
notacake29-May-05 3:12 
GeneralRe: Custom Control Woes Pin
spif200130-May-05 1:55
spif200130-May-05 1:55 
GeneralRe: Custom Control Woes Pin
spif200130-May-05 1:59
spif200130-May-05 1:59 

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.