University of Lethbridge - CPSC
RecurrenceSequence.cpp
Assignment 3 - Operator Overloading - SM 25This page covers the updated functions for Assignment 3. Most of your logic from Assignment 2 (like the constructors, destructor, read(), and generateSequence()) stays the same. These do not need to be modified.
No Changes Needed
These functions are already correct from Assignment 2 and do not need to be modified:
RecurrenceSequence()RecurrenceSequence(int aVal, int bVal, int pVal, int qVal, int len)RecurrenceSequence(const RecurrenceSequence& other)RecurrenceSequence& operator=(...)~RecurrenceSequence()void read()void generateSequence()
What’s New or Modified
All of the code below are the new things that need to be added for this assignment.
RecurrenceSequence operator+(const RecurrenceSequence& other) const
This operator lets you add two sequences together using the + symbol. It creates a new sequence where each element is the sum of the corresponding elements in the two original sequences.
Keep reading this lesson
You've reached the end of the free preview. Unlock the rest of this lesson plus 27 more lessons in University of Lethbridge - CPSC.
- Unlimited coding questions
- Unlimited access to all classroom material
- Weekly live call for questions and guidance
- 3,000 AI tutor tokens / month
- Personal SQL database (3 MB)
- Progress tracking
Cancel any time.