Tasks studies - laboratory
Write a generic class Pojemnik
(Container) that stores an element of any type. Create methods to:
Implement and test a generic Pair
class. Refer to slide 10 from the lecture for guidance. Create different types of pairs and test them.
Implement tuple classes: TupleTwo
, TupleThree
, TupleFour
, which store two, three, and four values, respectively.
TupleFour
inherits from TupleThree
, and TupleThree
inherits from TupleTwo
.TupleTwo
class can be created based on the Pair
class from Task 1 or implemented from scratch.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.
Test the programs from slides 37 and 38 of the lecture. Add other types of classes with fruits.