#include "stdafx.h"
#include<iostream>
using namespace std;
class A
{
public:
A(int i,int j)
{
a=i;
b=j;
}
void move(int x,int y)
{
a+=x;
b+=y;
}
void show()
{
cout<<"("<<a<<","<<b<<")"<<endl;
}
private:
int a,b;
};
class B : public A
{
public:
B(int i,int j,int k,int l):A(i,j)
{
x=k;
y=l;
}
void show()
{
cout<<x<","<<y<<endl; //“,”Error:表达式必须包含整数或枚举类型
}
void fun()
{
move(3,5);
}
void f1()
{
A::show();
}
private:
int x,y;
};
int _tmain(int argc, _TCHAR* argv[])
{
A a(1,2);
a.show();
B b(3,4,5,6);
b.fun();
b.show();
b.f1();
system("pause");
return 0;
}
杨__羊羊
MMMHUHU
慕标琳琳
慕田峪9158850
随时随地看视频慕课网APP