CCEA A-Level Software Systems Development CL4
Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures
Exception Handling and Managing Input and Output
Testing an Object Oriented Application
Graphical User Interface Objects and Events
Multiple Forms and Linking to Files
Designing, Testing and Evaluating an Event Driven Application
Reasons for Systems Development and Systems Methodologies
Managing Projects
Testing Strategies
Database Concepts and Entity Relationship Modelling
Normalisation and Structured Query Language
Project Management and the Systems Approach in Practice
Defining Requirements and Documenting the Design
Building a Desktop Solution with a Database
Testing and Evaluating the Solution
Objects, Classes and Data Structures
Overloading methods
- 3 things to know
- AS Unit 1
Overview
Method overloading, key difference between overloading and overriding and risk of overloading a method with very similar parameter lists.
What you need to know
Answer each one before you reveal it.
At what point is the choice between overloaded methods made?
A class Rectangle offers both Rectangle(double w, double h) and Rectangle(double side). What is the second constructor for?
Questions from this subtopic
Each one with the model answer underneath.
- 1
What is method overloading?
Model answer
Method overloading is declaring several methods in one class that share a name but differ in the number, types or order of their parameters.
- 2
Why is overloading useful to the programmer calling the class?
Model answer
Overloading lets one sensible name cover the same operation applied to different kinds or amounts of data, so the caller does not have to remember a separate name for each case.
- 3
Which part of a method must differ for two methods to be overloaded?
Model answer
The parameter list must differ, because the compiler tells overloaded methods apart by the number, the types and the order of their parameters.
- 4
Can two methods be overloaded on their return type alone?
Model answer
Two methods that differ only in return type cannot be overloaded, because a call written on its own gives the compiler nothing by which to choose between them.
- 5
At what point is the choice between overloaded methods made?
Model answer
The choice is made by the compiler from the types of the arguments written in the call, before the program is ever run.
- 6
A class Printer declares show(int n), which prints the word whole, and show(double n), which prints the word decimal. What does the call show(5); print?
Model answer
The call prints whole, because the literal 5 is an int and the compiler prefers the exact int match to widening the value into a double.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Objects, Classes and Data Structures, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.