我爱Aspx >> Asp.Net >> 用NEW重新定义方法google_ad_width = 250; google_ad_height = 250; google_ad_format = "250x250_as"; google_color_url = "000000";
interface IStorable
{
void Read( );
void Write( );
}
public class Document : IStorable
{
.........
public void Write( )
{
Console.WriteLine(
"Document Write Method for IStorable" );
}
}
public class Note : Document
{
.........
public new void Write( )
{
Console.WriteLine(
"Implementing the Write method for Note!" );
}
}
public class Tester
{
static void Main( )
{
// create a document reference to a Note object
Document theNote = new Note( "Test Note" );
这里Note类中的write方法,用了new以后是不是就算是一个全新的方法,和原来的IStorable接口没有关系,只能算是Note类的方法呢?
Document theNote = new Note( "Test Note" );里面,theNote是Document的一个引用变量,它指向一个Note的对象,Note对象没有具体的名字,还只是一个内存中的地址,可以把theNote看作同时是Document和Note的对象吗,就像一个手里抓着两个气球?
Ҷƪл˵?
有关FCKeditor编辑器的问题![07-06]
如何在ASP中删除非文本文件[07-06]
为什么Flash图片轮换效果出不来?[07-06]
自定义标签-众高手帮我看下,这个..[07-06]
急急急[07-06]
如何比较字符串相等(不区分大小..[07-06]
[弱问]安装MyEclipse之后Tomcat无..[07-06]
在线等!谢谢!大家帮帮忙![07-06]
iis出错了[07-06]
如何用js脚本输出一段Html代码[07-06]