Tirion

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  27 随笔 :: 0 文章 :: 62 评论 :: 4 引用

公告

2005年2月12日 #

public class GrandPa
{
    
protected const int age = 100;
    
public void DoSth(){}
}

public class Father
{
    
private const new int age = 75;
    
public void DoSth(){}
}

public class Son
{
    
public void DoSth()int i = age; }
}
此时Son.DoSth()中i会等于多少呢?VS.NET调试期监视显示为75,但是事实上是100。
下午写代码的时候不小心把Father.age写成了private,结果总是造成Son.DoSth数组运算越界,调试察看又没有问题,百思不得其解,这个问题也算是隐藏的相当晦暗了。
posted @ 2005-02-12 17:26 Findekano 阅读(903) 评论(2) 编辑