Question

For Question 14 - 15, please refer to the following code snippet. 1 class Fitness 2 { 3 int Jumping; int Running; 12 }; 8 cla

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Q 14:

The correct answer is B)

Explanation:

A) is wrong as this is the correct statement that RoundIsAShape class is inheriting from the class Fitness

C) is wrong as RoundISAShape is a child class of Fitness class

D) is wrong as this statement is also correct that, objects of child class are able to access the member functions and data of the parent class Fitness

B) is the correct option as the statement is wrong.

Q 15:

The correct answer is B)

Explanation:

protected for line 3 and public for line 10

members of Fitness class can be protected as they need to be accessed from the RoundIsAShape class and protected allows to access the members from child class.

RoundIsAShape class members can be public as they need to be access from outside.

PLEASE UPVOTE IF YOU FOUND THIS HELPFUL!
PLEASE COMMENT IF YOU NEED ANY HELP!

Add a comment
Know the answer?
Add Answer to:
For Question 14 - 15, please refer to the following code snippet. 1 class Fitness 2...
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
  • Question 1 10 pts Inheritance is a capability of C++ to represent increased specialization that is...

    Question 1 10 pts Inheritance is a capability of C++ to represent increased specialization that is often found in real world relationships. True False Question 2 10 pts Inheritance between a child and parent object exhibits an 'relationship. Question 3 10 pts As you move down an inheritance relationship from parent to child, you typically move from a general to specific description. True False Question 4 10 pts The syntax for declaring DerivedClass to publicly inherit from BaseClass is given...

  • Giving the following code snippet: Discuss the reasons of using private access specifier in some places...

    Giving the following code snippet: Discuss the reasons of using private access specifier in some places of the code and public in other places. Additionally, discuss how can you test this code. public class Book {      privateStringbookName;      privateinted;      private String author;           public Book (String n, int e, String a)      {            bookName = n;            ed = e;            author = a;      }           /**      * Gets the book name.     ...

  • 1. Questions on inheritance. (a) Consider the following program segment: 1 class Array2 2 private: ClassX...

    1. Questions on inheritance. (a) Consider the following program segment: 1 class Array2 2 private: ClassX a: // ClassY b: // assume class ClassY is defined. assume class ClassX is defined . 3 4 5 public: 6 Array2 (int size) ( a new Clas sX [ size]; // a is an array of ClassX objects b new ClassY [size]: 1/ b is an array of ClassY objects 7 8 9 ) 10 ClassX getA() (return a; ) ClassY getB ()...

  • Question 19 Given the following class: public class Swapper ( private int x; private String y...

    Question 19 Given the following class: public class Swapper ( private int x; private String y public int z; public Swapper( int a, String b, int c) ( x-a; y b; zC; public String swap() ( int temp -x; x-z z temp; return y: public String tostring() ( if (x<z) return y: else return" +x+z What would the following code output? Swapper r new Suapper( 5, "no", 10); System.out.printin( r. swap ) ): no no510 510 e 15 Question 20...

  • C++ programming. Please provide copy/paste code and a screenshot of the code being ran in the...

    C++ programming. Please provide copy/paste code and a screenshot of the code being ran in the compiler. Vertebrates are the types of animals that typically have backbones with a bony skeleton and a brain. Vertebrates can be mammals, reptiles, amphibians, fish, and birds. Based on this information, do the following: Create a C++ hierarchy of the vertebrates class along with the attributes (variables) and behaviors (functions) using C++ syntax. Is this an example of single inheritance or multiple inheritance? Why...

  • Question 11     The feature that enables you to split source code between two or more...

    Question 11     The feature that enables you to split source code between two or more files is: Select one: a. base class b. partial classes c. generics d. dynamic link library e. package Question 12     Packaging data attributes and behaviors into a single unit so that the implementation details can be hidden describes an object-oriented feature called: Select one: a. abstraction b. objects c. inheritance d. polymorphism e. encapsulation Question 13     A multitier application would probably have:...

  • For the following code, which statement is not true? Class Point {     private:         double...

    For the following code, which statement is not true? Class Point {     private:         double y;         double z;     public:         double x; }; a.z is available to objects of type Point declared outside the class. b.x is available to objects of type Point declared outside the class. c.x, y, and z are called members variables of the class. d.The name of the class is Point. Given the code below, What is the most accurate description of AwesomeClass(AwesomeClass...

  • C++ Practice: Answer Whichever you can & it'll help a lot. Thank you! Question 1. Implement...

    C++ Practice: Answer Whichever you can & it'll help a lot. Thank you! Question 1. Implement the constructors and member function of each of the classes (Marks 15) class Fraction{ private: int numerator; int denominator; public: Fraction(int, int); float fractionValue();//determines the value of numerator/denominator }; class Problem{ private: Fraction f[3]; public: Problem(int, int, int, int, int, int); Fraction largestFraction();//Returns the fraction having largest fraction value }; Question 2: In the following Inheritance problem #include<iostream> #include<string> using namespace std; class Animal{...

  • Code fragment 2: template <class T> Tplus slancio, T12) ( Tret: Tet - ol +12 Tetun...

    Code fragment 2: template <class T> Tplus slancio, T12) ( Tret: Tet - ol +12 Tetun Tet; } Code fragment 3: Problem 1 (10 points)-True/False Submit a document called Answers.doc Answer the following true/false questions. You must correctly state WIIY your answer is true or false in order to receive credit class Popcorn std::string flavor protected: float price Code fragment 1: public class Employee friend class Movie_gcer Popcorn slumstring Daver, float price) public: static int total employees; int employee_id; this...

  • Question 6 (1 point) What is the output of the following code snippet? Please ensure your...

    Question 6 (1 point) What is the output of the following code snippet? Please ensure your answe. spaced according to the program code output. public static void main(String[] args) int channel = assignChannel (2); System.out.println("Channel: " + channel); ) public static int assignChannel(int channel) return channel + 3; > A/

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