看书上的看懂了总写不好。
程序代码:
#include <string> #include <iostream> using namespace std; class And { public: void display(); And(int num,float sc,string nam) { number=num; score=sc; name=nam; } protected: int number; float score; string name; }; void And::display() { cout<<"number:"<<number<<endl; cout<<"name:"<<name<<endl; cout<<"score:"<<score<<endl; } class And_1:public:And { public: void show(); And_1(int num,float sc,string nam,int sequenc):And(num,sc,nam) {sequence=sequenc;} protected: int sequence; }; void And_1::show() { And::display(); cout<<"sequence:"<<sequence<<endl; } int main() { And_1 c1(10010,95.7,"Wang-Ling",07); c1.show(); }为什么通不过编译?