Question: Q3) Find the errors of the following code, and explain why? (5 points) #include AxyAAx=a;xO_(4)y+=3;=>(1,2);=>A class A ) { y+=3; void print is a

Q3) Find the errors of the following code, and explain why? (5 points)\ #include

AxyAAx=a;xO_(4)y+=3;=>(1,2);=>A\ class A

)

\ { y+=3; void print is a censhant function can not modify Data

}

\

{

} display (): =>\ Void print is a constrat funcrian and display () non constant coutA is a class in itialize one variable and object 1 has atwo variable. const A object2(1);\

{

} object2.displayx():\ object\ (2) is a consiant object and display x() is a non constant function and constant object can not call non constant function.
 Q3) Find the errors of the following code, and explain why?

Q3) Find the errors of the following code, and explain why? (5 points) \#include h> class A{ public: const int x : int y : and aconstructor no return void A (int a) error because A aconstructor Jalue and dont writing Void x=a;yrap because x is a constant function and constant function cannat modify Oum4 void display () \{cout ; function then aconstant function can not call non Constant function void main() A object1(1,2): A is aclass intialize one variable and object 1 has atwo variable. const A object2(1); \} object2.displayx(): object (2) is a consiant object and display x() is a non censtant function and constuntobject can noi call non Constant function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!