C#简单问题(加分)
来源:百度知道 编辑:UC知道 时间:2024/06/04 11:32:58
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Exam_Q2
{
abstract class AbstractSchool
{
public abstract string CampusName { get; set; }
public abstract string City { set; }
public abstract void GetCampus
{
return String;
}
}
public class School : AbstractSchool
{
public override void GetCampus
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
}
}
最后显示Error 1 A get or set accessor expected
那个renturn错误了~~在线等
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Exam_Q2
{
abstract class AbstractSchool
{
public abstract string CampusName { get; set; }
public abstract string City { set; }
public abstract void GetCampus
{
return String;
}
}
public class School : AbstractSchool
{
public override void GetCampus
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
}
}
最后显示Error 1 A get or set accessor expected
那个renturn错误了~~在线等
public abstract String GetCampus{get; set;}
public abstract string CampusName { get; set; }
public abstract string City { get; } //这里至少得有get
public override void CampusName
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public override void City
{
get
{
throw new NotImplementedException();
}
}
public abstract void GetCampus
{
return String;
}
这样子都行吗?
void类你给返回一个string?
应该是这样
public abstract String GetCampus
{
return String;
}
public abstract void GetCampus
{
return String;
}
}
这个你的是无返回类型啊
用心去看看这个abstract是怎么用的