0
fill the line 1
#include <iostream> using namespace std; class Container { int arr[5]; int i; public: Container() : i(-1) { } ____________________ { // LINE-1 this->arr[++i] = val; return *this; } operator int() { return arr[i--]; } }; int main() { Container c; int k; for (int i = 0; i < 5; i++) { cin >> k; c = k; } for (int i = 0; i < 5; i++) cout << (int)c << " "; return 0; }
7 Answers
+ 3
Kahkeshan Begum
Is that one of the quizzes, or you see it in lesson, or where?
+ 2
Okay I get it đ
+ 1
https://www.programiz.com/cpp-programming/operator-overloading
That link will help you
+ 1
Container operator =(int &val) --- is the answer
+ 1
@ipang i m gng through a ol course where i shld do this kind of assignment
0
I had gone through tht before posting the question . The problem is operator overloading shld b done with variable declaration of " Val ", which I am unable to do .....
Thanks for the try
0
help