Calling constructor overload when both overload have same signature

前端 未结 4 716
傲寒
傲寒 2020-12-09 16:58

Consider the following class,

class Foo
{
    public Foo(int count)
    {
        /* .. */
    }

    public Foo(int count)
    {
        /* .. */
    }
}
         


        
4条回答
  •  一生所求
    2020-12-09 17:36

    The fact is that they do not both have the same signature - one is using generics while this other is not.

    With those methods in place you could also call it using a non-int object:

    Foo foo = new Foo("Hello World");
    

提交回复
热议问题