C#

Multiple Inheritance using C# Language.

Multiple Inheritance using C# Language.
using System;

public class Shape

{

public void setWidth(int w)

  {   

    width = w;    

  }

public void setHeight(int h)

  { 

     height = h;   

 }

protected int width;

protected int height;

}

public interface PaintCost                 

  {  

      int getCost(int area);  

  }

class Rectangle : Shape,PaintCost   

{

public int getArea()

  {   

    return(width * height);   

  }

public int getCost(int area)

  {

     return area *70;     

  }

}

class RectangleTester

{

public static void Main()

{

Rectangle Rect=new Rectangle();

int area;

Rect.setWidth(5);

Rect.setHeight(7);

area =Rect.getArea();

Console.WriteLine("\nTotal area: {0}",Rect.getArea());

Console.WriteLine("\nTotal paint cost: ${0}",Rect.getCost(area));

}

}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.