開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
補充說明(Supplement):
#include <iostream.h>
class CA{
public:
CA(){a=30; b=40; c=50; }
int a, b, c;
};
class CB: public CA{
public:
CB(){ x=10; y=20;}
int x, y;
int getM(){ return x*y; }
int getN(){ return CA::a*CA::b*c/x; }
};
main()
{
CB b;
b.CB::x = 5;
b.a = 1;
b.CA::a = 5;
b.c = 2;
cout<< "result= "<< b.getM()<< endl;
cout<< "result= "<< b.getN()<< endl;
}
請問這兩個答案輸出
會100,80
不懂他的trace code
希望有人肯解析一下,桑Q