C#菜鸟问题 “ConsoleApplication19.Circle”不会实现接口成员“ConsoleApplication19.IShape.Caculate()”

pghgqg 2009-04-24 07:38:19
那里错
解析下


菜鸟问题 “ConsoleApplication19.Circle”不会实现接口成员“ConsoleApplication19.IShape.Caculate()”

using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication19
{
class Program
{
static void Main(string[] args)
{
Circle circle = new Circle(35);
MyClass myclass = new MyClass(circle);
Console.ReadLine();
}
}
interface IShape
{
int Area
{
get;
set;
}
void Caculate();

}
class Circle : IShape
{
int area = 0;
public Circle(int m_Area)
{
area = m_Area;
}
#region IShape 成员
public int Area
{
get
{
return area;
}
set
{
area = value;
}
}
public void Cauculate()
{
Console.WriteLine("area");
}
#endregion
}
class MyClass
{
public MyClass(IShape shape)
{
shape.Caculate();
Console.WriteLine(shape.Area);
}
}
}
...全文
163 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
pghgqg 2009-05-01
  • 打赏
  • 举报
回复
狂汗!!!!
写少了个字母
shape.Caculate();
这个Cauculate();
罪过啊
yeaicc 2009-04-24
  • 打赏
  • 举报
回复
错误原因:
类 从 接口 派生,但该类未实现该接口的一个或多个成员。

类必须实现它从中派生的接口的所有成员,否则必须声明为 abstract。

111,126

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧