Exam Review Flashcards
Principles and characteristics of imperative language?
Statements are executed in a step-wise, sequence manner.
Order of execution is crucial
Programmer must declare variables
Memory management is responsibility of a programmer
Principles and characteristics of oo language
Encapsulation: functions that operate on data of an objects are tied together in data structures
Polymorphism
Inheritance
Data is hidden
Principles and characteristics of functional language
Simple and concise syntax and semantics
Repetition is expressed as recursion
Lazy evaluation expressions are evaluated only when needed
What makes up a class?
Data(Private, protected, public) + functions that work this data and provide controlled access to outside world
Compile time polymorphism?
Binding at compile to a particular function
Compiler needs sufficient information to resolve which function to call
What is run-time polymorphism?
Inheritance, virtual functions and pointers.
private vs public vs protected
Private: only member functions of that class can access the variables Protected: same as private except it gives access to derived classes Public: accessible to the world
When are constructor and destructor function invoked?
Constructor - to create an object
Destructor - when the object falls out of scope or whenever delete operator is called
Differences when inheriting via private and public access specifiers.
Using private access specifier for inheritance -> makes everything private in the derived class
Using public access specifier for inheritance -> makes protected data members protected in the derived class + everything becomes public available
order of invocation of constructors and destructors
Constructors - parent then children
Destructors - children first then up the inheritance to the most parent class
What is a pure virtual function?
A virtual function has no definition in the base class. The derived classes must provide a definition for the function. This class becomes abstract class