topic 10 Flashcards
base class
A class whose attributes (properties) and behaviors (methods) are
inherited
Example: A
Derived class
A class that inherits attributes (properties) and behaviors (methods) from
another class
Example: B/C
An attribute
These are defined as variables of the appropriate type
A behaviour
These are defined as functions with appropriate parameters
Describe 2 benefits of inheritance
Objects/code can be re-used
New code is needed only for additional methods, this increases productivity
This reduces development time
The base class will already have been tested
Only the derived class new methods require testing
This reduces testing time
What’s an object
A self-contained component design relating to a real-world object that is constructed from a class.
It describes the details of the object including data or properties and functions
Is an instance of a class
What’s a method
A section of code contained within a class
It defines an action that an object of that class can perform
Methods only have access to data within their own class
What’s a class
A template that specifies the properties and method that relate to a real-world object
It’s claimed that the object-oriented approach is an effective way of developing software.
Object-oriented programming uses the concept of self-contained objects,
which contain both program routines and the data being processed.
Advantages:
Classes and methods created for one object-oriented application can be
reused
Once an object is created it can be used without knowledge
of how it is coded
Due to its modular nature, there is an extensive design/planning stage
resulting in less maintenance
Disadvantages:
A steep learning curve as encapsulation and inheritance can be difficult to
understand