CS253 IQ 08
Show Main.IQ08 as a slide show.
Reflection
int zulu;
cout << typeid(zulu).name() << '\n';
i
What will this code emit?
int zulu
int
zulu
i
- It cannot be determined.
Sure, gcc returns 'i'
, but it’s implementation-defined.
Virtual Inheritance
What problem does virtual inheritance address?
- Stroustrup’s Syntax Sin
- Polymorphic Pointers
- Namespace Numbering
- Method Mangling
- Dreaded Diamond
Dreaded Diamond: A inherits from B & C, B & C both inherit from D.
Programming Paradigms
Which statement is true?
Makefile
s are event-driven.
- C++ is event-driven.
- Spreadsheets are imperative.
- Graphics programs are declarative.
- Object files are declarative.
C++ can operate in any of these modes;
nearly all programs are somewhat imperative.
The best answer is that Object files are declarative, IMHO.
Exceptions
What sort of argument can throw
take?
- only
std::Exception
and classes derived from it
- any scalar or object
- any scalar or copy-constructable object
- any object
- any copy-constructable object
anything: any scalar, any object
Exceptions
int main() {
throw 42;
cout << "honeybee\n";
}
terminate called after throwing an instance of 'int'
SIGABRT: Aborted
🐝
What will this program display?
42
honeybee
an error message
honeybee
an error message
- an error message
honeybee
honeybee
- an error message
Once it throw
s, nothing else happens in that code.