+ 1
In constructor inheritance who call first and execution first ?
2 Antworten
+ 3
#include <iostream>
using namespace std;
class Parent {
public:
Parent() {
cout << "Parent's constructor\n";
}
~Parent() {
cout << "Parent's destructor\n";
}
};
class Child : Parent {
public:
Child() {
cout << "Child's constructor\n";
}
~Child() {
cout << "Child's destructor\n";
}
};
int main() {
Child c;
return 0;
}
Run this code and see what happens
+ 1
Can u give one example by passing 2 value ...