本站提供程序员计算机面试经验学习,笔试经验,包括字节跳动/头条,腾讯,阿里,美团,滴滴出行,网易,百度,京东,小米,华为,微软等互联网大厂真题学习背诵。
答案:
这是qklbishe.com第4971 篇笔试面试资料
提供答案分析,通过本文《阅读该程序,给出程序的输出结果。 #include <iostream.h> class A { public: A(int i,int j) { a1=i; a2=j; } void Print() { cout<<a1<<‘,'<<a2<<endl; } private: int a1,a2; }; class B { public: B() : b(0) { } B(int i) : b(i) { } void Print() { cout<<b<<endl; } private: int b; }; class C: public A { public: C(int i,int j,int k,int l):A(i,j),c(l) { } void Print() { A::Print(); b.Print(); cout<<c<<endl; } private: B b; int c; }; void main() { A a(7,8); a.Print(); B b(9); b.Print(); C c(4,5,6,7); c.Print(); }-笔试面试资料》可以理解其中的代码原理,这是一篇很好的求职学习资料
本站提供程序员计算机面试经验学习,笔试经验,包括字节跳动/头条,腾讯,阿里,美团,滴滴出行,网易,百度,京东,小米,华为,微软等互联网大厂真题学习背诵。
答案:
阅读该程序,给出程序的输出结果。
#include <iostream.h>
class A
{
public:
A(int i,int j)
{
a1=i;
a2=j;
}
void Print()
{
cout<<a1<<‘,'<<a2<<endl;
}
private:
int a1,a2;
};
class B
{
public:
B() : b(0)
{
}
B(int i) : b(i)
{
}
void Print()
{
cout<<b<<endl;
}
private:
int b;
};
class C: public A
{
public:
C(int i,int j,int k,int l):A(i,j),c(l)
{
}
void Print()
{
A::Print();
b.Print();
cout<<c<<endl;
}
private:
B b;
int c;
};
void main()
{
A a(7,8);
a.Print();
B b(9);
b.Print();
C c(4,5,6,7);
c.Print();
}
9
4,5,
0
文章部分来自互联网,侵权联系删除
www.qklbishe.com