Question

Question 4: If the line does not compile explain why: (10Pts) B objB: // Linel: Linel compiles: Yes/No class Af (Circle right
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Line 1 does not compile as object A is of abstract type because of virtual function output

Line 2 does not compile as object B is of abstract type because of virtual function output

Line 3 compiles

Line 4 compiles

Line5 does not compile as setX is protected within this context

Line 6 does not compile for the same reason as line 5

Line 7 this method is not directly accessible

Line 8 compiles

Line 9 compiles

Do give a thumbs up

Add a comment
Know the answer?
Add Answer to:
Question 4: If the line does not compile explain why: (10Pts) B objB: // Linel: Linel...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hi, please the code should be good es. Onless you Thera Problem3: Write a template class Box with Three class param...

    Hi, please the code should be good es. Onless you Thera Problem3: Write a template class Box with Three class parameters representing the three dimensions (length, width and height), of the Box. Include public methods to display and set the data values as well as a function that swaps the values so that, after the swap, the first element is cast into the second and the second is cast into the Third and the third is cast first. overlaod <<...

  • Need help with a multiple inheritance work Question Compile and run the file. If you find...

    Need help with a multiple inheritance work Question Compile and run the file. If you find any compilation errors,explain their reason as comments in the code. Then fix the errors such that the program compiles and runs. Explain the motivation of your modifications in the code and their effects on the execution inheritance.cpp file #include<iostream> using namespace std; class A { int x; public: void setX(int i) {x = i;} void print() { cout << x; } }; class B:...

  • It's been too long since I have done any Java programming. Can anyone help me with...

    It's been too long since I have done any Java programming. Can anyone help me with this one? Thank you 6.5 Write the declaration for a class named C that declares: (1) a private int instance variable named mX; (2) a private int class variable named mY initialized to 0; (3) a private int class constant named A which is equivalent to 100; (4) a public int class constant named B which is equivalent to 200; (5) public accessor and...

  • 4.a) 4.b> 4.c) C++ Programming Lab Exercise 09 Inheritance. Friend Functions, and Polymorphism (virtual functions) 4.a)...

    4.a) 4.b> 4.c) C++ Programming Lab Exercise 09 Inheritance. Friend Functions, and Polymorphism (virtual functions) 4.a) Run the following code and observe the output. #include <iostream> #include <string> using namespace std; class Vehicle public: void print() { cout << "Print: I am a vehicle. \n"; } void display() { cout << "Display: I am a vehicle. \n"; } }; class Car: public Vehicle { public: void print() { cout << "Print: I am a car.\n"; } void display() { cout...

  • I need help with my java code i am having a hard time compiling it //...

    I need help with my java code i am having a hard time compiling it // Cristian Benitez import java.awt.Color; import java.awt.Graphics; import java.util.ArrayList; import javax.swing.JPanel; Face class public class FaceDraw{ int width; int height; int x; int y; String smileStatus; //default constructor public FaceDraw(){ } // Getters and Setters for width,height,x,y public int getWidth(){ return width; } public void setWidth(int width){ this.width=width; } public int getHeight(){ return height; } public void setHeight(int height){ this.height=height; } public int getX(){ return...

  • QUESTION 7 10 points Save Answer Given is a java class 'lustrate'. What are the contents...

    QUESTION 7 10 points Save Answer Given is a java class 'lustrate'. What are the contents of the object 13 right after line 13 in the main method? publie class Illustrate publie atatie void main (Stringl argo private int x private static int y 0; public statie int count-0 public Illustrate0) 1. Illustrate 11 -new 1llustrate(3) 2. Illustrate 12·new Illustrate(5); Illustrate.incrementy public Illustrate(int a) 9. Illustrate.count 10 public Illustrate(Illustrate I) 12 13. Illustrate 13·new Illustrate(11); 14 15. Illustrate 14-13; 16....

  • Please Explain, Thanks :) QUESTION 2 Ghen is a java class าน¡strate, what are the contents...

    Please Explain, Thanks :) QUESTION 2 Ghen is a java class าน¡strate, what are the contents of the object right after line 13 in the main method ? public class Illustrate public ธtatic void main (String[] args) int xj private statie int y o public statie int count 0; public 1llustrate() 1. Illustrate I1 2. Illustrate 12 new Illustrate(3); new Illustrate(5): 4. Illustrate.incrementY) public Illustrate(int a) 9. Illustrate.count 10 public Illustrate(Illustrate 1) this.x I.x public vold setx(inta) 12. 13. Illustrate...

  • Extend the code from Lab6.A template is given to you with CircleHeader.h, Circle.cpp and CircleMain.cpp Use...

    Extend the code from Lab6.A template is given to you with CircleHeader.h, Circle.cpp and CircleMain.cpp Use the same Circle UML as below and make extensions as marked and as needed. Given below is a UML for the Painting Class. You will need to write PaintingHeader.h and Painting.cpp. The Painting Class UML contains a very basic skeleton. You will need to flesh out this UML and add more instance variables and methods as needed. You do NOT need to write a...

  • Java Programming. please give me answer and explain in details. Question 1 (c) (4 marks] For...

    Java Programming. please give me answer and explain in details. Question 1 (c) (4 marks] For each of the methods equals and hashCode in the following class, explain whether or not they are implemented correctly (with respect to their specification in the object class and any additional specification in this class). If they are not implemented correctly. show how they may be rewritten to address the problems that you have identified. *An immutable representation of a term in a polynomial....

  • why do i get this syntax error? for example: i have these two classes: class Maze...

    why do i get this syntax error? for example: i have these two classes: class Maze { private: int row, col; cell **arr; public: Maze(int r = 0, int c = 0) { this->row = r; this->col = c; arr = new cell*[row]; for (int i = 0; i < row; i++) arr[i] = new cell[col]; } }; class cell { private: bool visited; bool up, down, right, left; int x, y; int px, py; char status; public: cell() {...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT