public class classA:classB,System.Security.Principal.IIdentity { public classA() { // // TODO: 在此处添加构造函数逻辑 // } } 就这点代码,还报错,我倒了
你一定要实现IIDentity的接口啊。光继承不实现怎么行呢?在类ClassA加入: // IIdentity interface requirments: // property AuthenticationType (string) // property IsAuthenticated (bool) // propertty Name (string) /// <summary> /// 只读属性:描述身份验证用户的方式 /// </summary> public string AuthenticationType { get { return "Custom Member FormsAuthentication"; } set { // do nothing } } /// <summary> /// 只读属性:是否验证了当前用户 /// </summary> public bool IsAuthenticated { get { // assumption: all instances of a SiteIdentity have already // been authenticated. return true; } } /// <summary> /// 只读属性:姓名 /// </summary> public string Name { get { //返回Name值 return "test"; } }
to: ccssme() public class classA:classB,System.Security.Principal.IIdentity { public classA() { // // TODO: 在此处添加构造函数逻辑 // } }这点代码当然出错,你这个接口的那几个具体的实现在哪里呀??
可我是继承一个类一个接口啊!
BeyondLove2000(马) :你还没有实现必要的属性(和方法)我不明白你的意思???
报的是不会实现??
{
public classA()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
}
就这点代码,还报错,我倒了
// IIdentity interface requirments:
// property AuthenticationType (string)
// property IsAuthenticated (bool)
// propertty Name (string)
/// <summary>
/// 只读属性:描述身份验证用户的方式
/// </summary>
public string AuthenticationType
{
get
{
return "Custom Member FormsAuthentication";
}
set
{
// do nothing
}
}
/// <summary>
/// 只读属性:是否验证了当前用户
/// </summary>
public bool IsAuthenticated
{
get
{
// assumption: all instances of a SiteIdentity have already
// been authenticated.
return true;
}
}
/// <summary>
/// 只读属性:姓名
/// </summary>
public string Name
{
get
{
//返回Name值
return "test";
}
}
public class classA:classB,System.Security.Principal.IIdentity
{
public classA()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
}这点代码当然出错,你这个接口的那几个具体的实现在哪里呀??
故在ClassA里面要包含System.Security.Principal.IIdentity的方法名才能编译通过
classA继承classB没有问题
System.Security.Principal.IIdentity 是个接口要实现他的全部方法和属性
所以没有代码就不对了
// IIdentity interface requirments:
// property AuthenticationType (string)
// property IsAuthenticated (bool)
// propertty Name (string)
这一段是注释吧!