Tasks studies - laboratory
Project maintained by dawidolko Hosted on GitHub Pages — Theme by dawidolko
Lab09 - Application of Generic Types
Task 0.
Write a generic class Pojemnik (Container) that stores an element of any type. Create methods to:
- Retrieve the element,
- Set the element,
- Display the element.
Task 1.
Implement and test a generic Pair class. Refer to slide 10 from the lecture for guidance. Create different types of pairs and test them.
Task 2.
Implement tuple classes: TupleTwo, TupleThree, TupleFour, which store two, three, and four values, respectively.
TupleFourinherits fromTupleThree, andTupleThreeinherits fromTupleTwo.- The
TupleTwoclass can be created based on thePairclass from Task 1 or implemented from scratch.
Test the functionality of different tuple types with various parameters.
Task 3.
Given a program implementing a dynamic array that stores int values using regular arrays, modify the code to make it generic, allowing it to store any reference types.


Task 4.
Test the programs from slides 37 and 38 of the lecture. Add other types of classes with fruits.