C#多态

2018-06-17  本文已影响0人  叫我颜先生

静态多态

    void print(int i)
    {
       Console.WriteLine("Printing int: {0}", i );
    }

    void print(double f)
    {
       Console.WriteLine("Printing float: {0}" , f);
    }
    public static Box operator+ (Box b, Box c)
    {
       Box box = new Box();
       box.length = b.length + c.length;
       box.breadth = b.breadth + c.breadth;
       box.height = b.height + c.height;
       return box;
    }

动态多态

上一篇 下一篇

猜你喜欢

热点阅读