levo

Programming

Inheritance and evaluating the object-oriented approach

  • 3 things to know
  • AS Unit 1

Overview

Method overriding, superclass with two sensible subclasses and class hierarchy.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

Explain the is-a test for deciding whether inheritance is appropriate.

Evaluation

Give two advantages of the object-oriented approach.

Key term

Why does the object-oriented approach make maintenance easier?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Define inheritance.

    Model answer

    Inheritance is the mechanism by which a new class takes on the attributes and methods of an existing class, and may then add further ones of its own or change what it has received.

  2. 2

    What names are given to the two classes in an inheritance relationship?

    Model answer

    The class being inherited from is called the superclass, parent or base class, and the class inheriting from it is called the subclass, child or derived class.

  3. 3

    Give one reason inheritance reduces the amount of code that has to be written.

    Model answer

    Anything common to several kinds of object is written once in the superclass, and each subclass inherits it rather than repeating it.

  4. 4

    What is method overriding?

    Model answer

    Method overriding is the replacement of an inherited method by a subclass's own version, so that objects of the subclass behave differently while the method keeps the same name.

  5. 5

    Give an example of a superclass with two sensible subclasses.

    Model answer

    A superclass called Account could have the subclasses Current Account and Savings Account, each inheriting the balance attribute and adding rules of its own.

  6. 6

    What is a class hierarchy?

    Model answer

    A class hierarchy is the tree of classes formed when subclasses inherit from a superclass and are themselves inherited from, with the most general class at the top.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Systems Analysis and Development Approaches
Design, Development and Testing
Implementation and System Security
Programming

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A check requires a value.
presencerangeformat

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

ANormal data is 12, which should be accepted.
BBoundary data is 1 and 50, which should be accepted.
C0 and 51, just outside the limits, should be rejected.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

One byte is made up of 8 bits.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Programming, 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.