*请教各位两个问题*
Interface I{
void Foo();
}
abstact calss C:I
{
public abstract viod Foo();
}
class C1:C:I
{
vid I.Foo()
{
console.WriteLine("C1.I.Foo");
}
public override void Foo()
{
Console.WriteLine("C1.Foo");
}
}
Class C2:C1,I
{
void I.Foo()
{
Console.WriteLine("C2.I.Foo");
}
public override void Foo()
{
Console.WriteLline("C2.Foo");
}
}
Class Entrry
{
static void Main(string[] args)
{
I i;
i=new C1();
i.Foo();
i=new C2();
i.Foo();
((C2)i).Foo();
C c;
c=new Ci();
c.Foo();
c=new C2();
c.Foo();
((I)c).Foo();
}
请写出这段编程程序的输出
还有两题如下:
2、 Static void Main(string[] args)
{
int i=1;
object o=i
i=2;
Console.WriteLine(i+","+(int)o);
}
}
}
这段程序中,一共发生了()次装箱(boxing)操作,()次拆箱(unboxing)操作。
3、class Person
{
public string Name
{get;set;}
public override bool Equals(object o)
{
if (o==null || o.GetType()!=typeOf(Person))
{
return false;
}
return this.Name==((Person)o).Name;
}
public override int GetHashCode()
{
return this.Name==null?0:this.Name.GetHashCode();
}
}
class Entry
{
static void (Main (string[] args)
{
Person p1=new Person();
Person p2=new Person();
Console.WriteLine(p1==p2);
Console.WriteLine(p1.Equals(p2));
Console.Writeline(object.Equals(p1;p2));
Console.Writeline(Object.Equals(p1.p2));
Console.Writeline(Object.ReferenceEquals(p1,p2));
Hashtable table=new Hashtable();
table.Add(p1,"value");
Console.WriteLine(table.Contains(p2));
}
}
请写出这段程序的输出
--------------------编程问答-------------------- 头疼 懒得看
--------------------编程问答-------------------- 帮帮忙,好吗,上面的美女,能帮一点是一点,谢谢了,国庆愉快!!
补充:.NET技术 , C#