5 ms·
Pretty much. I tried three questions: Understanding the first rested on the fact that a friend function declaration requires that the relevant function declar
by ajross 13y ago
Pretty much. I tried three questions:
Understanding the first rested on the fact that a friend function declaration requires that the relevant function declaration be present above it in the translation unit (e.g. friend int A::foo();" requires that "class A" be defined, even though the prototype is otherwise correct). Meaningless trivia, and something every compiler will remind you about instantly and clearly.
The second one was pretty straightforward and basically about understanding that a superclass constructor is invoked before the subclass constructor. That's certainly important to understand, but in my experience rarely misunderstood except by true OO newbies (basically the same behavior has to hold for any static type system with inheritance).
The third called a public virtual function through a superclass pointer and expected you to recognize that declaring the derived function private in the subclass that the object belongs to didn't matter. Again, trivia that doesn't correspond to any meaningful real-world code pattern.
I gave up after that. Yawn.
- eridius 13y agoYou gave up too early. How about the question that tests your knowledge of std::async behavior, in a way that has very real practical results? (very real in that if you don't understand the behavior, you're almost certainly using std::async incorrectly and with no benefit to your code). Or the one that makes sure you understand that, if a function isn't declared virtual, then you get static dispatch instead. Or, heck, the one that ensures you know that floating-point literals default to double, and that this fact affects function overload resolution.