0

Here is question.

Create a class that imitates part of the functionality of the basic data type int. Call the class Int (note different capitalization). The only data in this class is an int variable. Include member functions to initialize an Int to 0, to initialize it to an int value,to display it (it looks just like an int), and to add two Int values. Write a program that exercises this class by creating one uninitialized and two initialized Int values,adding the two initialized values and placing the response in the uninitialized value,and then displaying this result. Code: https://code.sololearn.com/cJDUtBk4Gp9Y/?ref=app

26th Apr 2022, 3:43 PM
Muhammad Talha Atif
Muhammad Talha Atif - avatar
4 odpowiedzi
+ 1
Change a.add(a, b) To a.add(10,10);
26th Apr 2022, 4:03 PM
A͢J
A͢J - avatar
+ 1
proGAMBLER No not right You have created class Int And created object 'a' so how you can pass as a parameter in add method because add method accept int values not class object. And what about 'b'? which is not defined.
26th Apr 2022, 4:37 PM
A͢J
A͢J - avatar
0
dude just tell me is it right according to statement ?..I know I have to pass integers in parameters
26th Apr 2022, 4:05 PM
Muhammad Talha Atif
Muhammad Talha Atif - avatar
26th Apr 2022, 4:39 PM
Muhammad Talha Atif
Muhammad Talha Atif - avatar