What 3 preprocessor directives should be in your class specification file?
Front
#ifndef class_h //include guard
#define class_h //define class
#endif //end class
Essentially, this protects against including the same header file multiple times.
Back
What is true of destructor parameters?
Front
They never have any. The parenthesis are always empty.
Back
How is a class created in c++
Front
class className
{
public:
.....
private:
.....
};
Back
Default Constructor? How is it used?
Front
A constructor that has no parameters. No parenthesis are used when one is used.
EX:
Shape square;
Back
What is an inline member function?
Front
A function definition inside the class definition. Useful for simple functions such as accessors
Back
How is a constructor created? How is the definition created separately?
Front
className();
className:: className()
{
}
Back
Class Implementation File?
Front
A .cpp file where the function definitions are all defined.
Back
How are objects created?
Front
className objectVar;
Ex: Shape triangle;
Back
How is a destructor created? How is the definition created?
Front
~className();
~className:: className()
{
}
Back
What is the level of accessibility for public and private?
Front
Public: all variables/functions are available outside the class
Private: variables/functions available only inside the class
Back
How is a function definition created separately for a member function of a class?
Front
returnType ClassName :: functionName()
{
}
Back
Class Specification File?
Front
a .h file where the class and its member variables and functions are defined.
Back
What 3 files are usually used in conjunction together when doing Object Oriented Programming in c++?
Front
Class specification file
Class implementation file
Client program
Back
Inside the client program and implementation file you must use what preprocessor directive to link your class?