9. In the following code, indicate if the selected lines are legal or illegal: #include class...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
9. In the following code, indicate if the selected lines are legal or illegal: #include class small { public: private: }; small() void k() const; void h(int i); friend void f(small z); int size; }; void small::k() const { {size = 0;}; small x, Yi y; // LEGAL/ILLEGAL? x.size = y.size; // LEGAL/ILLEGAL? x.size = 3; // LEGAL/ILLEGAL? }; void small::h(int i) { }; void f(small z) { small x, yi x = y; // LEGAL/ILLEGAL? x.size = y.size; // LEGAL/ILLEGAL? x.size = 3; // LEGAL/ILLEGAL? x.h(42); // LEGAL/ILLEGAL? int main() { small x, Yi x = y; // LEGAL/ILLEGAL? x.size = y.size; // LEGAL/ILLEGAL? x.size = 3; // LEGAL/ILLEGAL? x.h(42); // LEGAL/ILLEGAL? std::cout < < "Hello, World! "; 9. In the following code, indicate if the selected lines are legal or illegal: #include class small { public: private: }; small() void k() const; void h(int i); friend void f(small z); int size; }; void small::k() const { {size = 0;}; small x, Yi y; // LEGAL/ILLEGAL? x.size = y.size; // LEGAL/ILLEGAL? x.size = 3; // LEGAL/ILLEGAL? }; void small::h(int i) { }; void f(small z) { small x, yi x = y; // LEGAL/ILLEGAL? x.size = y.size; // LEGAL/ILLEGAL? x.size = 3; // LEGAL/ILLEGAL? x.h(42); // LEGAL/ILLEGAL? int main() { small x, Yi x = y; // LEGAL/ILLEGAL? x.size = y.size; // LEGAL/ILLEGAL? x.size = 3; // LEGAL/ILLEGAL? x.h(42); // LEGAL/ILLEGAL? std::cout < < "Hello, World! ";
Expert Answer:
Answer rating: 100% (QA)
Lets analyze every line of code 1 X y LEGAL This line is prison due to the fact each x and y are gad... View the full answer
Related Book For
Java How To Program Late Objects Version
ISBN: 9780136123712
8th Edition
Authors: Paul Deitel, Deitel & Associates
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
re Regular Languages and Finite Automata (a) Let L be the set of all strings over the alphabet {a, b} that end in a and do not contain the substring bb. Describe a deterministic finite automaton...
-
Your home business uses 570 square feet of your 2,850 square foot home. If household expenses for the year were $28,558, how much was alloted to your business? Amount invested
-
Zammit Company reports net income of 90,000 in 2017. However, ending inventory was understated 5,000. What is the correct net income for 2017? What effect, if any, will this error have on total...
-
Based on the information provided in Table 8.19, calculate the estimated time to complete a textbook project. Rohan, an MBA fresh from the university, found an attractive position with a local...
-
You have made a review and preliminary evaluation of the Morgan Company's system of internal conirol, and based on this, you have designed a tentative audit program. Your next step is to perform...
-
Markland First National Bank of Rolla utilizes kanban techniques In Its check processing faci1ity. The following information is known about the process. Each kanban container can hold 50 checks and...
-
Identify the demand elasticity of the following products. Product #1: Natural Gas (used for heating a home) (0.5 points) - Elastic or Inelastic - Circle, highlight, or bold your answer Product #2:...
-
Below are incomplete financial statements for Benson. Incorporated. Requlred: Calculate the missing amounts. table [ [ BENSON , INCORPORATED ] , [ Income Statement ] , [ Year ended Decem ber 3 1 , 2...
-
(i) Let G be a non-cyclic group of order 8 with a cyclic subgroup K of order 4. Show that if G splits over K then G is isomorphic to either C x C4 or Dg, while if G does not split over K then GQ8....
-
A 1-kg cart and a 2-kg cart are held together with a coupler that contains a small charge. The charge is exploded and sends the \(1-\mathrm{kg}\) cart rolling away at \(+4.0 \mathrm{~m} /...
-
A bullet of speed \(v\) and inertia \(m\) strikes and gets embedded in a wooden block of inertia \(M\), initially at rest on a low-friction floor. Plot \(k_{f} / k_{i}\) as a function of \(M / m\)...
-
A 60-g Mars bar will supply you with \(1095 \mathrm{~kJ}\) of energy. How many of them would you need to get enough energy to climb the first \(800 \mathrm{~m}\) of the highest structure in the...
-
Roger Lowenstein argued that once you start looking at the world through the lens of trade-offs, policy debates become less about right and wrong and more matters of give and take. a. What does...
-
Apple. Apple seeks energetic, dedicated students with a passion to educate others about Apple products. The company prefers students who excel at time management, have a marketing or sales...
-
Use triple integral to find the volume of the solid enclosed by the cone z = V(x2 + y) and the plane z = 9.
-
Tiger, Inc. signed a lease for equipment on July 1, 2007.The lease is for 10 years (the useful life of the asset).The first of 10 equal annual payments of $500,000 was made on July 1, 2007.The...
-
Assuming that x = 5 and y = 1, what does each of the following statements display? a) System.out.printf("x = %d", x + 5); b) System.out.printf("Value of %d * %d is %d", x, y, (x * y)); c)...
-
Write an application that reads two integers, determines whether the first number tripled is a multiple of the second number doubled, and prints the result.
-
Rewrite lines 1025 in Fig. 16.3 to be more concise by using the asList method and the LinkedList constructor that takes a Collection argument. Fig. 16.3 1 // Fig. 16.3: ListTest.java // Lists,...
-
Calculate the volume occupied by isopropanol vapour at \(200^{\circ} \mathrm{C}\) and 10 bar by using (a) Ideal gas equation of state (b) Virial equation of state (c) Virial equation of state \[...
-
The Dieterici equation of state is given by \[ P(V-b) \exp \left(\frac{a}{R T V} ight)=R T \] where \(a\) and \(b\) are constants. Develop the relations to determine the constants \(a\) and \(b\) in...
-
At \(17^{\circ} \mathrm{C}\), at constant pressure, the heat of combustion of amorphous carbon is 96960 cal and that of \(\mathrm{CO}\) to \(\mathrm{CO}_{2}\) is \(67960 \mathrm{cal}\). Determine the...
Study smarter with the SolutionInn App