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
-
(a) Guo Company, Ltd. sells three different categories of tools (small, medium, and large). The cost and net realizable value of its inventory of tools are as follows. _________________________Cost...
-
A certain building wall consists of 6.0 in of concrete [k = 1.2 W/m C], 2.0 in of fiberglass insulation, and 38 in of gypsum board [k = 0.05 W/m C]. The inside and outside convection coefficients...
-
What is the plain-meaning rule?
-
Power Brite Painting Company specializes in refurbishing exterior painted surfaces that have been hard hit by humidity and insect debris. It uses a special technique, called pressure cleaning, before...
-
Direct Labor Budgeted $14,200, Actual $14,200, Indirect Labor Budgeted 5,800, Actual 5,400, Utilities Budgeted 1,900, Actual 2,200, Rent Budgeted 3500, Actual 3500, Marketing Budgeted 150, Actual...
-
M Studios sells a camera listed at $400, less 25%. Todd's Factory sells the same camera for $325. What rate of markdown would Todd's have to offer to match the reduced price at M Studios? 8.5% 7.5%...
-
Discuss the players in the micro-environment and suggest how their roles are changing.
-
You recently started a job as digital marketing manager for a major retailer. Produce a checklist of all the different legal issues that you need to check for compliance on the retailers digital...
-
Discuss the extent to which the eight key strategy decisions are important to a new online retail business.
-
Social media can be a powerful communication channel. Discuss the opportunities and pitfalls of these platforms with reference to the main social networks and examples of how brands have used them...
-
Why is due diligence analysis so important to the merger process?
-
The capital budgeting process determines: O Where you will get the long-term financing to pay for the investment. O What long-term investments or projects the business should take on. O None of the...
-
Refer to the table to answer the following questions. Year Nominal GDP (in billions) Total Federal Spending (in billions) Real GDP (in billions) Real Federal Spending (in billions) 2000 9,817 578...
-
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,...
-
Peters Personal Training Service had been in business for several years. In June 2019, as a result of a dispute with the owner, the accountant of the business disappeared and took all the records...
-
In September 2019, Niem Duong opened a car hire business. The following transactions occurred during the first month of the business (ignore GST). Required (a) Journalize the above transactions. (b)...
-
Your first assignment on your new job was to determine why the 31 December 2018 trial balance did not balance. In your review of the records you uncovered a number of errors described below. 1. The...
Study smarter with the SolutionInn App