SoftwareEngineeringStudyProjects / KnowYourKnowledge

Combination of Personal Knowledge Management and Learning Management System. This is a study project aimed at creating relatively big codebase for object-oriented programming and similar courses.
MIT License
2 stars 4 forks source link

Create base class for collections #40

Open KlishchD opened 2 years ago

KlishchD commented 2 years ago

Create a templated base class for collections with methods: void add(T item) - to add element bool remove(size_t index) - to remove an element, returns true if successfully deleted and false otherwise T get(size_t index) (or operator[]) - to get element using index size_t size() - to get size of the collection. T - is a type of elements to be stored in a collection.

kzhereb commented 2 years ago

At least operator[] should probably return T& (reference to element) - this would allow changing items, not just accessing them (this is similar to how collections in C++ standard library work)