标题:基类成员不能在派生类成员初始化列表中初始化,为什么?
取消只看楼主
全世界安静
Rank: 2
等 级:论坛游民
帖 子:104
专家分:65
注 册:2012-6-4
结帖率:31.58%
已结贴  问题点数:10 回复次数:0 
基类成员不能在派生类成员初始化列表中初始化,为什么?
class base
{
public:
   int a;
};
class child:base
{
 public:
   int c;
   child(int x,int y,int z):a(x),b(y),c(z);//错误
   child(int x,int y,int z):c(z)
    {
      a=x;b=y;
    }//只能是这样,为什么?
}
搜索更多相关主题的帖子: public 
2012-06-15 10:26



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




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

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