Q4. Which of the following code samples can be compiled successfully? Assume that all the classes are defined in separate files. Sample 1 class AA { public AA (int i) { System.out.print ("AA"); } class BB extends AA { public BB(int i) { System.out.print("BB");

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.4: Class Inheritance And Polymorphism
Problem 2E
icon
Related questions
Question
100%
Kindly explain this properly which one gives Error and Attach Screen shot of the output.
Q4. Which of the following code samples can be compiled successfully? Assume that
all the classes are defined in separate files.
Sample 1
class AA {
public AA (int i) {
System.out.print("AA");
class BB extends AA {
public BB(int i) {
System.out.print("BB");
Sample 2
class CC {
public CC(int i) {
System.out.print ("CC");
class DD extends CC {
public DD(int i) {
super (i);
System.out.print("DD");
Sample 3
class EE {
class FF extends EE {
// Empty
public FF(int i) {
System.out.print ("FF");
A. Samples 1 and 2 only.
B. Samples 1 and 3 only.
C. Samples 2 and 3 only.
D. Samples 1, 2 and 3.
E.
None of the above.
Transcribed Image Text:Q4. Which of the following code samples can be compiled successfully? Assume that all the classes are defined in separate files. Sample 1 class AA { public AA (int i) { System.out.print("AA"); class BB extends AA { public BB(int i) { System.out.print("BB"); Sample 2 class CC { public CC(int i) { System.out.print ("CC"); class DD extends CC { public DD(int i) { super (i); System.out.print("DD"); Sample 3 class EE { class FF extends EE { // Empty public FF(int i) { System.out.print ("FF"); A. Samples 1 and 2 only. B. Samples 1 and 3 only. C. Samples 2 and 3 only. D. Samples 1, 2 and 3. E. None of the above.
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Printers
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning