Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Diamond example
#include <iostream> using namespace std; class Parent { public: Parent(int i) : m_i {i} { cout << "Parent "<< m_i << endl; } ~Parent() { cout << "~Parent "<< m_i << endl; } private: int m_i; }; class Child1 : public virtual Parent { public: Child1(int i) : Parent(1), m_i {i} { cout << "Child1 "<< m_i << endl; } ~Child1() { cout << "~Child1 "<< m_i << endl; } private: int m_i; }; class Child2 : public virtual Parent { public: Child2(int i) : Parent(2), m_i {i} { cout << "Child2 "<< m_i << endl; } ~Child2() { cout << "~Child2 "<< m_i << endl; } private: int m_i; }; class Grandchild : public Child1, Child2 { public: Grandchild(int i) : Child1(3), Child2(3), Parent(5), m_i {i} { cout << "Grandchild "<< m_i << endl; } ~Grandchild() { cout << "~Grandchild "<< m_i << endl; } private: int m_i; }; int main() { Grandchild a(4); }
run
|
edit
|
history
|
help
0
Print system time
Graphs Iteration 2.1 Directed Graphs
why
general
Linker error while passing constexpr variable as const &
(non?)-template template parameters for container stream insertion
Recursive Function Calling Example with Stack Addresses
What's the problem with this?
applidiumResto_corrigé
std::reference_wrapper