Files
CSCI-1200/lectures/25_inheritance/constructor_test1.cpp
2025-04-15 22:10:48 -04:00

19 lines
331 B
C++

#include <iostream>
class Base {
public:
Base(int x) {
std::cout << "Base constructor: " << x << std::endl;
}
};
class Derived : public Base {
public:
Derived(int x) : Base(x) { // member initializer list calls Base constructor
std::cout << "Derived constructor" << std::endl;
}
};
int main(){
}