COS3711
SUMMARY
STUDY NOTES
2022 UPDATE.
, Stuvia.com - The Marketplace to Buy and Sell your Study Material
UML DIAGRAMS & CLASS DESIGN:
Syntax:
Syntax for variable and parameters: - NameVar : Type
Syntax for functions: Basically the same except it has () with parameters in
them. E.g. +FuncName(parameter list): return Type
Note: Parameters must also be name: Type
Note: Constructors don’t have type
When we inherit then child class point to parent:
Arrow points to parent class.
, Stuvia.com - The Marketplace to Buy and Sell your Study Material
When they say client they mean a class that will manage all the other classes.
Client can be class, function or just code (driver program).
Assuming that PhoneReader is class that
reads in Phone’s from a file and convert them to QList of Phone objects.
Example:
Downloaded by: STUDYLAB2022 |
Distribution of this document is illegal
, Stuvia.com - The Marketplace to Buy and Sell your Study Material
Note if they say data members should not have to be repeated in sub-classes
means that they should be under protected.
The Reader and Writer objects can either use FilmList object or QList<Film>(i.e.
read function can return FilmList(in this case this case) or it can return
QList<Film>. But always try for FilmList
Example:
Answer
Example:
• MyPrepaid and MyContract inherit from Contract
• ContractList contains (diamond) Contract.
• Contract inherits from QObject
• Note the # sign is protected specifier.
Note:
This arrow is for inheritance:
Downloaded by: STUDYLAB2022 |
Distribution of this document is illegal
SUMMARY
STUDY NOTES
2022 UPDATE.
, Stuvia.com - The Marketplace to Buy and Sell your Study Material
UML DIAGRAMS & CLASS DESIGN:
Syntax:
Syntax for variable and parameters: - NameVar : Type
Syntax for functions: Basically the same except it has () with parameters in
them. E.g. +FuncName(parameter list): return Type
Note: Parameters must also be name: Type
Note: Constructors don’t have type
When we inherit then child class point to parent:
Arrow points to parent class.
, Stuvia.com - The Marketplace to Buy and Sell your Study Material
When they say client they mean a class that will manage all the other classes.
Client can be class, function or just code (driver program).
Assuming that PhoneReader is class that
reads in Phone’s from a file and convert them to QList of Phone objects.
Example:
Downloaded by: STUDYLAB2022 |
Distribution of this document is illegal
, Stuvia.com - The Marketplace to Buy and Sell your Study Material
Note if they say data members should not have to be repeated in sub-classes
means that they should be under protected.
The Reader and Writer objects can either use FilmList object or QList<Film>(i.e.
read function can return FilmList(in this case this case) or it can return
QList<Film>. But always try for FilmList
Example:
Answer
Example:
• MyPrepaid and MyContract inherit from Contract
• ContractList contains (diamond) Contract.
• Contract inherits from QObject
• Note the # sign is protected specifier.
Note:
This arrow is for inheritance:
Downloaded by: STUDYLAB2022 |
Distribution of this document is illegal