Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
4 views2 pages

Assignment 3Fwrstzd

Assignment 3 for COSC-1102 requires students to design a template class GenericContainer<T> that supports various operations such as adding, removing, searching, and displaying elements. Submissions must be made online via CMS/LMS by May 19, 2025, and must adhere to strict guidelines to avoid plagiarism. The assignment emphasizes the use of STL's std::vector<T> and includes operator overloading for specific functionalities.

Uploaded by

farooq112ab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

Assignment 3Fwrstzd

Assignment 3 for COSC-1102 requires students to design a template class GenericContainer<T> that supports various operations such as adding, removing, searching, and displaying elements. Submissions must be made online via CMS/LMS by May 19, 2025, and must adhere to strict guidelines to avoid plagiarism. The assignment emphasizes the use of STL's std::vector<T> and includes operator overloading for specific functionalities.

Uploaded by

farooq112ab
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 3 (Graded)

COSC-1102-Object Oriented Programming


Course Instructor: Dr. Nasir Mehmood
Submission Deadline: May 19, 2025, 11:59:59 PM
Submission Method: Submit on CMS/LMS

Important Instructions
ˆ The assignments must be submitted online using CMS/LMS. Submission
by email or any other method will not be entertained.
ˆ Copying assignment from others or submitting assignment that is com-
pleted by some other students can result in zero-marks in the assignment
or failing the course depending on the severity of the plagiarism. (The
case may be forwarded to disciplinary committee for further action)
ˆ Do not wait for the last day to start. Start as early as possible.
ˆ Write complete code in single file ”YourCompleteRollNo.cpp” for example
(CSEC261100200.cpp) and create a zip file ”YourCompleteRollNo.zip”.
Make sure there is no folder or any other file in the zip file. Upload
”YourCompleteRollNo.zip” on CMS

Description
Design a template class GenericContainer<T> that can hold a collection of
elements of any data type. It is encouraged to reuse functionality of STL as
much as possible in the definition of the member functions. The class should
support the following operations:

Member Functions
Add the following member functions:
ˆ AddElement A method to add an element to the container.
ˆ RemoveElement A method to remove an element by value.
ˆ SearchElement A method to search for an element and return its index
(or -1 if not found).
ˆ GetSize A method that returns the current number of elements in the
container.
ˆ DisplayElements A method to print all elements in the container.

1
Operator Overloading
Overload the following operators:
ˆ operator[] to access an element by index.

ˆ operator+ to concatenate two containers (same type).

ˆ operator== to compare two containers for equality.

Constraints
ˆ Internally use a std::vector<T> from STL to store elements.

ˆ Prevent invalid access (e.g., out-of-bound indexing).

ˆ Use exception handling for runtime errors.

You might also like