Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+ Are they breakable for any reason?

Answered: 1 week ago

Question

=+When and under what circumstances are contracts renegotiated?

Answered: 1 week ago

Question

=+Are the contracts enforceable?

Answered: 1 week ago