[ create a new paste ] login | about

Link: http://codepad.org/MMlYcvJw    [ raw code | output | fork ]

C++, pasted on May 24:
1
2
3
4
5
6
7
8
struct A { };
struct B : A { };
struct C : virtual B { };
int main() {
  C *c = 0;
  A *a = c;
  c = static_cast<C*>(a);
}


Output:
1
2
3
In function 'int main()':
Line 7: error: cannot convert from base 'A' to derived type 'C' via virtual base 'B'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: