Click here to Skip to main content
15,887,477 members
Home / Discussions / C#
   

C#

 
AnswerRe: private/public get/set Pin
Luc Pattyn3-May-08 5:40
sitebuilderLuc Pattyn3-May-08 5:40 
GeneralRe: private/public get/set Pin
PIEBALDconsult3-May-08 5:46
mvePIEBALDconsult3-May-08 5:46 
GeneralRe: private/public get/set Pin
George_George3-May-08 19:38
George_George3-May-08 19:38 
GeneralRe: private/public get/set Pin
George_George3-May-08 19:37
George_George3-May-08 19:37 
GeneralRe: private/public get/set Pin
Luc Pattyn3-May-08 22:49
sitebuilderLuc Pattyn3-May-08 22:49 
GeneralRe: private/public get/set Pin
George_George4-May-08 0:00
George_George4-May-08 0:00 
QuestionAutomated Mail Merge: Help! Pin
Member 42630173-May-08 2:44
Member 42630173-May-08 2:44 
Questioninterface implementation Pin
George_George3-May-08 2:19
George_George3-May-08 2:19 
Hello everyone,


I am migrating from C++ to C#. The following compile error makes me confused. Suppose in interface there is a method called Abc which returns object, and in the implementation class, there is also a method called Abc, but the return type is List<int>, I think List<int> is already a type (derived type) of object, so no need to explicitly implement Interface.Abc again, but here is a compile error.

D:\Visual Studio 2008\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs(14,11): error CS0738: 'MyList.Foo' does not implement interface member 'MyList.IFoo.Abc()'. 'MyList.Foo.Abc()' cannot implement 'MyList.IFoo.Abc()' because it does not have the matching return type of 'object'.


Could anyone show me what is the rule I break here please?

public class MyList
{

    interface IFoo
    {
        object Abc();
    }

    class Foo : IFoo
    {
        public Foo()
        {

        }
        
        public List<int> Abc()
        {
            return new List<int>;
        }

    }

    static void Main()
    {
        Foo f = new Foo();
        return;
    }
}



thanks in advance,
George
AnswerRe: interface implementation Pin
Roger Alsing3-May-08 2:28
Roger Alsing3-May-08 2:28 
GeneralRe: interface implementation Pin
George_George3-May-08 2:31
George_George3-May-08 2:31 
AnswerRe: interface implementation Pin
snorkie3-May-08 2:30
professionalsnorkie3-May-08 2:30 
GeneralRe: interface implementation Pin
George_George3-May-08 2:33
George_George3-May-08 2:33 
GeneralRe: interface implementation Pin
snorkie3-May-08 2:41
professionalsnorkie3-May-08 2:41 
GeneralRe: interface implementation Pin
George_George3-May-08 2:43
George_George3-May-08 2:43 
AnswerRe: interface implementation Pin
tgrt3-May-08 14:51
tgrt3-May-08 14:51 
GeneralRe: interface implementation Pin
George_George3-May-08 18:15
George_George3-May-08 18:15 
GeneralRe: interface implementation Pin
tgrt4-May-08 4:07
tgrt4-May-08 4:07 
QuestionA static riddle (or: how to avoid lazy instantiation?) Pin
Luca Leonardo Scorcia3-May-08 1:45
professionalLuca Leonardo Scorcia3-May-08 1:45 
AnswerRe: A static riddle (or: how to avoid lazy instantiation?) Pin
carbon_golem3-May-08 4:15
carbon_golem3-May-08 4:15 
Questionopening pdf file in windows application using c# Pin
maruthi2-May-08 23:50
maruthi2-May-08 23:50 
AnswerRe: opening pdf file in windows application using c# Pin
Ed.Poore2-May-08 23:59
Ed.Poore2-May-08 23:59 
GeneralRe: opening pdf file in windows application using c# Pin
maruthi3-May-08 0:29
maruthi3-May-08 0:29 
GeneralRe: opening pdf file in windows application using c# Pin
Ed.Poore3-May-08 0:49
Ed.Poore3-May-08 0:49 
GeneralRe: opening pdf file in windows application using c# Pin
maruthi3-May-08 1:10
maruthi3-May-08 1:10 
GeneralRe: opening pdf file in windows application using c# Pin
Ed.Poore3-May-08 1:24
Ed.Poore3-May-08 1:24 

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.