Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class A {
- protected:
- int i;
- public:
- A() = default;
- A(int a) {
- i = a;
- cout << "A's constructor called" << endl;
- };
- };
- class B: A {
- private:
- A a_object(10); // Вместо создания initializer лист для инициализации объекта, почему нельзя сделать так?
- public:
- B() = default;
- };
- int main() {
- B object();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement