CSE2305 - Object-Oriented Software Engineering
Week 6
Topic 12: Revision of C++
Synopsis
Function pointers
I/O
Dynamic memory
References
¤
Classes
¤
Constructors
¤
and destructors
¤
Function overloading
const
member
¤
functions
Function pointers
What is a function pointer useful for?
How is a function pointer declared?
How is a function pointer used (i.e. how can functions be called through a function pointer)?
What is the relationship between function pointers and polymorphism
¤
?
I/O
What is the general syntax for doing output in a C++ program?
What is the general syntax for doing input in a C++ program?
What is the purpose of the
cin
object?
What is the purpose of the
cout
object?
What is the purpose of the
cerr
object?
What is the purpose of
endl
in the following output expression?
cout << "This sentence is false" << endl;
Dynamic memory
What is the name of the operator which allocates single objects dynamically?
What is the name of the corresponding deallocation operator?
What is the name of the operator which allocates arrays of objects dynamically?
What is the name of the corresponding deallocation operator?
Apart from reserving the required memory, what else do the allocation operators do?
Apart from reclaiming the specified memory, what else do the deallocation operators do?
References
¤
What is a "reference
¤
"?
What is the syntax for declaring a reference
¤
?
Once a reference
¤
is declared, how can it be distinguished from the original object it references
¤
?
What is a "reference
¤
parameter"?
What are the advantages of passing arguments by reference
¤
?
What are the disadvantages of passing arguments by reference
¤
?
In what ways are references
¤
and pointers similar?
In what ways do references
¤
and pointers differ?
Classes
¤
What is a "class
¤
"?
What is the syntax for declaring a class
¤
in C++?
What kinds of members
¤
can a class
¤
have?
What is "access" in the context of a C++ class
¤
?
What kinds of access can a class
¤
member
¤
have?
How are classes
¤
related to the concept of abstraction
¤
?
How are classes
¤
related to the concept of encapsulation
¤
?
Constructors
¤
and destructors
¤
What is a constructor
¤
?
Why is a constructor
¤
useful?
When is a constructor
¤
called?
What is a destructor
¤
?
Why is a destructor
¤
useful (and sometimes essential)?
When is a destructor
¤
called?
Why can a class
¤
have many constructors
¤
, but at most one destructor
¤
?
Function overloading
What is "function overloading"?
Why is function overloading useful?
What is the "signature
¤
" of a function?
How does the compiler work out which version of an overloaded function
¤
to call?
How can a call to an overloaded function
¤
be ambiguous?
const
member
¤
functions
What is a "const member
¤
function"?
Why are such member
¤
functions necessary?
What constraints does the compiler put on a const member
¤
function?
What is a "mutable
¤
data member
¤
¤
" and how does it relate to const function members
¤
¤
?
This material is part of the
CSE2305 - Object-Oriented Software Engineering
course.
Copyright © Jon McCormack & Damian Conway, 1998–2005. All rights reserved.