

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is a worksheet for csci261 students learning about function and operator overloading in c++. It includes true or false questions, operator overloading prototypes, and a c++ class implementation for complex numbers with addition, scalar multiplication, and output operator. The worksheet is not collected or graded, but serves as a useful tool for learning and studying for exams.
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


CSCI261 Lecture Questions #1 Function and Operator Overloading
This worksheet is for your use during and after lecture. It will not be collected or graded, but I think you will find it a useful tool as you learn C++ and study for the exams. Explain all false answers for the “True or False” questions; in general, show enough work and provide enough explanation so that this sheet is a useful pre-exam review. I will be happy to review your answers with you during office-hours, via Email, or instant messaging.
(b) True or False: The calling object is on the left of the operation symbol.
(c) True or False: The operator should return one of the arguments provided.
(d) True or False: The operator must be written in some class’ scope.
(b) Where would you find the answer to part a within myClass’ source files?
(c) Write the protoype of a global operator for multiplying an integer (LHS) with a myClass object (RHS). It should return a new myClass object.
(d) Where would you find the answer to part c within myClass’ source files?
(e) Assume myClass has a default constructor. Write a snippet of C++ that would invoke the two global operators prototyped in parts a and c.
CSCI261 Lecture Questions #1 Function and Operator Overloading
Page 2