C#中使用接口作参数(新手问题)
using System;
using System.Collections.Generic;
using System.Text;
namespace Example10_8
{
class program
{
public static void Main(string[] args)
{
Circle circle = new Circle(35);
MyClass myClass = new MyClass(circle);
Console.ReadLine();
}
}
//ISshape接口
interface ISshape
{
//ISshape属性
int Area
{
get;
set;
}
//ISshape方法
void Caculate();
}
//Circle类继承ISshape
class Circle : ISshape
{
//初始化字段
int area = 0;
//构造函数
public Circle(int m_Area)
{
area = m_Area;
}
#region ISshape成员
//Area属性
public int Area
{
get
{
return area;
}
set
{
area = value;