+ 1

[CPP] Project Problem

Hello, In this project we have to use operation overloading to add two queue objects. I am getting an error that “operator+ is not declared as a function”. Please let me know where I made a mistake. My code starts at line 41 till before the main function declaration. https://code.sololearn.com/cMDq2f6YMNKJ/?ref=app

23rd Jun 2022, 9:16 PM
Areeb Qureshi
2 Answers
+ 1
Function declaration for overload operator is wrong.. Use this : Queue operator+(Queue &q){ Other errors tempArr, obj are undeclared.. You mean 'q' for 'obj' may be..!! Hope you can correct all simply.. Hope it helps.. edit: Queue operator+(Queue &obj){ will fix the issue. remove 'u' declare tempArr
23rd Jun 2022, 9:59 PM
Jayakrishna 🇼🇳
+ 1
That helped me to fix the code. Thank you
23rd Jun 2022, 10:10 PM
Areeb Qureshi