18th Mar 2021, 6:38 PM
Amateur
6 Answers
+ 2
The variables x and y in the print method are not declared and initialized. The x and y of the Complex method are not in scope of the print method and only exist within the scope of the Complex method.
18th Mar 2021, 6:55 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Use Real, Imag with in method print() instead of x,y.
18th Mar 2021, 7:46 PM
Jayakrishna 🇼🇳
+ 1
x,y are local variable of the constructor hence they are not in scope of print function. if you want you can replace x and y with real and Imag
19th Mar 2021, 8:25 AM
Suryansh sharma
Suryansh sharma - avatar
+ 1
ChaoticDawg Complete answer thank u
19th Mar 2021, 11:36 AM
Amateur
+ 1
19th Mar 2021, 11:36 AM
Amateur
0
Suryansh sharma so nice😊
19th Mar 2021, 11:37 AM
Amateur