hello
i would like to perform a method overloading with inheritance
my code is :

public abstract class Shape
    {
        protected Point position ;

        public Shape(int x, int y)
        {
            position = new Point(x , y);
        }

        public void show()
        {
            position.show();
        }
}

public class Rectangle : Shape
    {
        protected Size sizexy ;

        public Rectangle(uint x, uint y, int a, int b) : base (a,b)
        {
            sizexy = new Size(x, y) ;
        }

        public Rectangle(Point p, Size s) : base(p.pgsx, p.pgsy)
        {
            sizexy = new Size(s.gsx, s.gsy);
        }

        public void show ()
        {
            Console.WriteLine("Rect size (" + sizexy.gsx.ToString() + "," + sizexy.gsy.ToString() + ") ");
            base.show();
        }

    }

when i run show method on rectangle it only preforms base.show without console.....
it also gives me a warning : something about hiding inherited member.
how can i fix this ?

Recommended Answers

All 3 Replies

public new void show()
{
....
}

ok thanks

You're welcome Emilio

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.