#include class A { public:A(int i,int j) { a1=i; a2=j; } virtual void Print() { cout
来源:学生作业帮助网 编辑:作业帮 时间:2024/08/18 00:17:29
![#include class A { public:A(int i,int j) { a1=i; a2=j; } virtual void Print() { cout](/uploads/image/z/10522263-39-3.jpg?t=%23include+class+A+%7B+public%3AA%28int+i%2Cint+j%29+%7B+a1%3Di%3B+a2%3Dj%3B+%7D+virtual+void+Print%28%29+%7B+cout)
x)SK)MIUHI,.VpTV((MLr+QY@DCLkD#,kZ̢"*
"}_`gCC7\6ikӎOwrz>/6.{:{X|gR
:^
Ts= gZ^6,xھ
gsN{o]O7lgddW~qAbw ~
#include class A { public:A(int i,int j) { a1=i; a2=j; } virtual void Print() { cout
#include class A { public:A(int i,int j) { a1=i; a2=j; } virtual void Print() { cout
#include class A { public:A(int i,int j) { a1=i; a2=j; } virtual void Print() { cout
首先创建B的对象.因为B是继承A的 所以先执行A的构造函数 a1=10 a2 = 2
最后输出就是20了.