c++ Flashcards
What two lines usually precede every source file?
#include using namespace std;
does an array in c++ have a length field like java?
No
What does the header file contain in c++?
class/function declarations
What should member variables start with?
m_
When is a destructor executed?
When the instance of the constructor is overwritten
What is inlining in c++ and in java?
declaring body and header of a function on the same line
When overloading a function does the @overload need to precede the declaration?
No
What type is null?
int
What is the syntax for default parameters?
type function_name (type a, type b = value)
If B is a superclass of A, what is the syntax for inheritance?
class B : public A
Can a class inherit more than one class?
Yes
If the subclass method has to overwrite from the superclass what keyword must be used?
virtual
In the superclass, how is an abstract method defined?
virtual type name() = 0;
What is a pointer?
a memory address
How is a pointer defined?
int* name;
What are the 4 pillars of object oriented programming?
- ) Encapsulation
- ) Data hiding
- ) Inheritance
- ) Polymorphism
What is a trigraph?
A series of 3 symbols that represent compiler recognized symbols
Are trigraphs supported by every comiler?
No
What do enumeration types do?
Allow for custom types
What are the two ways to define a constant in c++?
using the #define or const keyword
What are the three type qualifiers in c++?
const, volatile, restrict
What are the differences between the auto and register storage classes?
It is given a small memory allocation, but does not have a memory address
What variables should be put in the register?
variables that need to be accessed quickly, such as counters
What is special about variables with the extern storage class?
They are visible to external source files
What is the traditional way for writing an infinite loop?
for(;;)
If Exp1 is false for Exp1 ? Exp2 : Exp3, what expression is executed?
Exp3
What is the difference between a struct and a class in c++?
A struct has members that are public by default for instances and derived classes