COS110 Tutorial6 -Memo

COS110 Tutorial6 -Memo - COS 110 Tutorial 6 Department of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
COS 110 Tutorial 6 Department of Computer Science 24 August Answer the questions in the spaces provided on the question sheets. Name and Surname: Student Number: Employee number : Venue : 1. Theory (a) (4) What is function overloading and operator overloading? Solution: Function overloading: A feature in C++ that enables several functions of the same name can be defined with different types of parameters or different number of parameters. This feature is called function overloading. The appropriate function will be identified by the compiler by examining the number or the types of parameters / argu- ments in the overloaded function. Function overloading reduces the investment of different function names and used to perform similar functionality by more than one function. Operator overloading: A feature in C++ that enables the redefinition of operators. This feature operates on user defined objects. All overloaded operators provides syntactic sugar for function calls that are equivalent. Without adding to / changing the fundamental language changes, operator overloading provides a pleasant façade. (b) (2) What is overloading unary operator? 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Solution: Unary operators are those which operate on a single variable. Overloading unary operator means extending the operators original functionality to operate upon object of the class. The declaration of a. (c)
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 5

COS110 Tutorial6 -Memo - COS 110 Tutorial 6 Department of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online