method-overloading

    0热度

    1回答

    我对C#和OOP相当陌生,而且我有一个关于继承的问题。 说我有: public abstract class Command { protected Command() { } public abstract string Execute(); public abstract string Execute(object o); } pu

    18热度

    2回答

    public class Program { private static <Program> void foo(Program x){ System.out.println(x+"-->1"); } private static void foo(final int i){ System.out.println(i+"-->2");

    1热度

    1回答

    我正在学习VB.NET和C# 我在VB中有以下代码,我在C#中转换。代码有一个Form,一个基类Vehicle和一个派生类Car。在VB中,基类Vehicle作为4个属性声明,只有一行没有设置&,而在C#中,我首先必须声明变量,然后设置&的4个属性获取方法(和很多行)。这是正确的方式,还是有一个像VB一样简单的方法? VB.NET Public Class Form1 Private S

    0热度

    1回答

    我有一个程序,仅仅完美的作品,但编译器仍然输出这个恼人的警告代码: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: 我的程序的simplyfied版本

    0热度

    1回答

    这是一个被问了很多次的问题,但没有一个答案似乎适用于此。 我有以下PageBase类: <?php class PageBase { public $templatefile = '404'; function Before() {} function After() {} function Display() { $sm

    1热度

    2回答

    额外的参数考虑以下情况: class Factory { private $x = 1; private $y = 2; private $z = 3; public function create(string $instance) { return new $instance($this->x, $this->y, $this->z);

    0热度

    1回答

    我有像编译好的java代码。 import org.jaitools.numeric.Range; Range<Integer> r1 = Range.create(1, true, 4, true); 转换为斯卡拉像 val r1: org.jaitools.numeric.Range[Integer] = org.jaitools.numeric.Range.create(1, true

    -1热度

    4回答

    当我写这个代码我收到错误 public class MethodOverloading { void m(short i) { System.out.println("SHort"); } public static void main(String[] args) { MethodOverloading ml=new MethodOverloading(); ml.m(1

    -1热度

    1回答

    我正在探索Visitor模式,下面是代码。请注意,我已经知道如何解决这个问题了 - 使用虚拟方法并用各种过载扩展Visitor界面。我想更好地理解c#中的类型和重载分辨率。 在测试方法中,当调用Accept方法时,它始终使用参数类型“Element”而不是BinaryOperator调用Visit方法。根据关于SO的其他类似问题的答案,这是因为在编译时解析了超载方法&对象类型。 链接: why-i

    1热度

    1回答

    我有这个重载函数: CString TestFunction(CString s, int number, int optPar1 = 123, int optPar2 = 456) //... CString TestFunction(int index, CString s, int numbers[], int optPar1 = 123, int optPar2 = 456) //...