Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
description:
3 times. One time for the first virtual occurences of BS in the heirarchy and once for each non-virtual occurence of BS. mid1 and mid2 together have one. mid3 and mid4 each have one.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
struct BS
{
BS()
{
std::cout << "Hello World" << std::endl;
}
unsigned int color;
};
struct mid1 : virtual public BS { };
struct mid2 : virtual public BS { };
struct mid3 : public BS { };
struct mid4 : public BS { };
struct DR : public mid1, public mid2,
public mid3, public mid4 { };
int main(int argc, char** argv)
{
DR d;
return 0;
}
Enter to Rename, Shift+Enter to Preview
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content