Question:

Which lines of code below should not compile?

1  struct Foo
2  {
3  };
4 
5  struct Bar
6  {
7  };
8 
9 
10 int main()
11 {
12     Foo* f = new Foo;
13 
14     Bar* b1 = f;
15     Bar* b2 = static_cast<Bar*>(f);
16     Bar* b3 = dynamic_cast<Bar*>(f);
17     Bar* b4 = reinterpret_cast<Bar*>(f);
18     Bar* b5 = const_cast<Bar*>(f);
19 
20     return 0;
21 }

Answers:


Keywords:

© 2017 QuizBucket.org