fix issue 24.04.24
This commit is contained in:
parent
f6faa4eb2f
commit
1ef1bb29e6
20
pr3-end.cpp
20
pr3-end.cpp
@ -36,7 +36,7 @@ protected:
|
||||
int b1;
|
||||
|
||||
public:
|
||||
B1(int V1 = 0, int V2 = 0) : A1(V1), A3(V2), b1(V1) { cout << "\nClass B1 constructor"; }
|
||||
B1(int V1 = 0, int V3 = 0) : A1(V1), A3(V3), b1(V1) { a1 = V1; a3 = V3; cout << "\nClass B1 constructor"; }
|
||||
virtual void print() { cout << "\nVariable of B1 class"; }
|
||||
virtual void show() { cout << "\nb1 = " << b1 << ", a1 = " << a1 << ", a3 = " << a3; }
|
||||
};
|
||||
@ -46,7 +46,7 @@ protected:
|
||||
int b2;
|
||||
|
||||
public:
|
||||
B2(int V1 = 0, int V2 = 0) : A2(V1), A3(V2), b2(V1) { cout << "\nClass B2 constructor"; }
|
||||
B2(int V2 = 0, int V3 = 0) : A2(V2), A3(V3), b2(V2) { a2 = V2; a3 = V3; cout << "\nClass B2 constructor"; }
|
||||
virtual void print() { cout << "\nVariable of B2 class"; }
|
||||
virtual void show() { cout << "\nb2 = " << b2 << ", a2 = " << a2 << ", a3 = " << a3; }
|
||||
};
|
||||
@ -56,7 +56,7 @@ protected:
|
||||
int c1;
|
||||
|
||||
public:
|
||||
C1(int V1 = 0, int V2 = 0, int V3 = 0) : A1(V1), B1(V1, V3), B2(V2, V3), c1(V1) { cout << "\nClass C1 constructor"; }
|
||||
C1(int V1 = 0, int V2 = 0, int V3 = 0) : B1(V1, V3), B2(V2, V3), c1(V1) { cout << "\nClass C1 constructor"; }
|
||||
virtual void print() { cout << "\nVariable of C1 class"; }
|
||||
virtual void show() { cout << "\nc1 = " << c1 << ", b1 = " << b1 << ", b2 = " << b2; }
|
||||
};
|
||||
@ -66,7 +66,7 @@ protected:
|
||||
int c2;
|
||||
|
||||
public:
|
||||
C2(int V1 = 0, int V2 = 0, int V3 = 0) : A1(V1), B1(V1, V3), B2(V2, V3), c2(V1) { cout << "\nClass C2 constructor"; }
|
||||
C2(int V1 = 0, int V2 = 0, int V3 = 0) : B1(V1, V3), B2(V2, V3), c2(V1) { cout << "\nClass C2 constructor"; }
|
||||
virtual void print() { cout << "\nVariable of C2 class"; }
|
||||
virtual void show() { cout << "\nc2 = " << c2 << ", b1 = " << b1 << ", b2 = " << b2; }
|
||||
};
|
||||
@ -76,7 +76,7 @@ protected:
|
||||
int c3;
|
||||
|
||||
public:
|
||||
C3(int V1 = 0, int V2 = 0, int V3 = 0) : A1(V1), B1(V1, V3), B2(V2, V3), c3(V1) { cout << "\nClass C3 constructor"; }
|
||||
C3(int V1 = 0, int V2 = 0, int V3 = 0) : B1(V1, V3), B2(V2, V3), c3(V1) { cout << "\nClass C3 constructor"; }
|
||||
virtual void print() { cout << "\nVariable of C3 class"; }
|
||||
virtual void show() { cout << "\nc3 = " << c3 << ", b1 = " << b1 << ", b2 = " << b2; }
|
||||
};
|
||||
@ -90,11 +90,11 @@ int main() {
|
||||
C3 c3(14, 15, 16);
|
||||
|
||||
|
||||
B1* ptr1 = &b1;
|
||||
B2* ptr2 = &b2;
|
||||
B1* ptr3 = &c1;
|
||||
B2* ptr4 = &c2;
|
||||
B1* ptr5 = &c3;
|
||||
A1* ptr1 = &b1;
|
||||
A2* ptr2 = &b2;
|
||||
A1* ptr3 = &c1;
|
||||
A1* ptr4 = &c2;
|
||||
A1* ptr5 = &c3;
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user