填空题
下列程序的运行结果是
【14】
。 #include <iostream. h> class A { int a, b; public: A() {a=b=0;} A(int aa, int bb) { a=aa; b=bb; cout<<a<<’’<<b<<end1; } }; void main() { A x, y(2,3),z(4,5); }
【参考答案】
2 3
点击查看答案&解析
<上一题
目录
下一题>
热门
试题
填空题
有以下程序#include <iostream>using namespace std;class Base{int a;public:Base(int x) { a=x; }void show() { cout<<a; }class Derived: public Base{int b;public:Defived(int i):Base(i+ 1 ),b(i) {}void show() { cout<<b; }};int main(){Base b(5),*pb;Derived d(1);pb=&d;pb->show();return 0;}运行后的打印结果是 【13】 。
点击查看答案
填空题
以下程序段的执行结果为 【15】 。#include<iostream.h>#define PLUS(x, y) x+ yvoid main(){int x=1, y=2,z=3,sum;sum=PLUS(x+ y, z)*PLUS(y, z);cout<< SUM= <<sum;cout<<end1;}
点击查看答案
相关试题
派生类中的成员不能直接访问基类中的 【1...