标题:求助
只看楼主
me100422
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2012-12-13
结帖率:50%
已结贴  问题点数:20 回复次数:2 
求助

#include<iostream>
using namespace std;
class Name
{
public:
    char name;
    Name(char b):name(b){}

};
class Dog:public Name
{
public:
    dog(int n,char c):Name(c),weight(n){}
    void getWeight(){cout<<weight<<" "<<name;}
private:
    int weight;
};
int main()
{
    Dog a(80,'d');
    a.getWeight();
    return 0;
}

--------------------Configuration: dxc6 - Win32 Debug--------------------
Compiling...
dxc6.cpp
H:\dxc6\dxc6.cpp(14) : error C2065: 'c' : undeclared identifier
H:\dxc6\dxc6.cpp(14) : error C2057: expected constant expression
H:\dxc6\dxc6.cpp(14) : error C2656: 'dog' : function not allowed as a bit field
H:\dxc6\dxc6.cpp(14) : error C2061: syntax error : identifier 'n'
H:\dxc6\dxc6.cpp(14) : error C2143: syntax error : missing ';' before '{'
H:\dxc6\dxc6.cpp(14) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
H:\dxc6\dxc6.cpp(26) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.

dxc6.obj - 1 error(s), 0 warning(s)
搜索更多相关主题的帖子: void private include public return 
2012-12-15 18:48
lz1091914999
Rank: 14Rank: 14Rank: 14Rank: 14
来 自:四川
等 级:贵宾
威 望:37
帖 子:2011
专家分:5959
注 册:2010-11-1
得分:20 
Dog(int n,char c):Name(c),weight(n){}

My life is brilliant
2012-12-15 18:54
liao25428301
Rank: 2
等 级:论坛游民
帖 子:13
专家分:26
注 册:2012-12-15
得分:0 
楼主大小写都乱写,这样怎能不出错
2012-12-17 01:57



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




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

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