标题:public与private
取消只看楼主
rgbtdkjcel
Rank: 1
等 级:新手上路
帖 子:294
专家分:0
注 册:2007-3-26
结帖率:50%
 问题点数:0 回复次数:0 
public与private
public class WildLife
{
public WildLife()
{
Elephant myElephant=new Elephant();
Mouse myMouse=new Mouse();
Cat myCat=new Cat();
FeedingTime(myElephant);
FeedingTime(myMouse);
FeedingTime(myCat);
}
public void FeedTime(Animal someCreature)
{
if(someCreature.ISHungry)
{
someCreature.Eat();
}
}
static void Main(string[] args)
{
WildLife w=new WildLife();
}
}

请问一下。这个wildLife构造函数的修饰符可不可以改成private呢??。
搜索更多相关主题的帖子: public private 
2007-09-22 17:55



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-172124-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.258371 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved