做了一个继承类.
详情如下:
using System;
using System.Collections;
using System.Text;
namespace AcceptTest
{
class name
{
string younname;
public name(string uname) //构造赋值;
{
this.younname = uname;
}
public void shownamemsg() //方法显示值
{
Console.WriteLine("你的名字是:{0}", younname);
}
}
class where:name
{
string yourwhere;
public where(string uwhere) //构造赋值;(此处的WHERE提示错误:NAME方法没有采用"0"个参数的重载.请问是什么错?应该怎么改正?谢谢)
{
this.yourwhere = uwhere;
}
public void showwheremsg() //方法显示值
{
Console.WriteLine("你来自{0}", yourwhere);
}
}
class Program
{
static void Main(string[] args)
{
//传值调用.
where wr = new where("beijing");
name nm = new name("uukk");
wr.showwheremsg();
wr.shownamemsg();
}
}
}