JUKE BOX

JUKE BOX

  • NA
  • 28
  • 7.5k

use of constructor in abstract class

Oct 16 2014 3:51 PM
when i wrote below program it gave me exception as
Error1'abstractclassconntruct.program' does not implement inherited abstract member 'abstractclassconntruct.A.area()'F:\net\abstractclassconntruct\abstractclassconntruct\Program.cs4315abstractclassconntruct

can anyone plz help me to sort out it???


using System;

namespace abstractclassconntruct
{
    public abstract class A
    {
        protected double x = 10;
        protected double y = 7;
        public A()
        {
            

        }
        public A(double x, double y)
        {
            
            this.x = x;
            this.y = y;
        }
        public abstract double area();
    }
    public class square : A
    {
        public square()
        { }
        public override double area()
        {
            return x * x;
        }
    }
        public class rectangle:A
    {
        public rectangle(double x,double y): base (x,y)
        { }
        public override double area()
        {
            return x * y;
        }
    
    }


        class program : A
        {
            static void Main(string[] args)
            {
                square s = new square();
                double areacal = s.area();
                rectangle r = new rectangle(10, 5);

                double areaca = r.area();
                Console.ReadKey();
            }
        }
    
    }



Answers (2)