28. d) Base classes are usually more specific than derived class.
Explanation: Base classes are always supposed to be generic and derived class to be more specific.
29. b) inheritance
Explanation:
In object-oriented programming, the concept of IS-A is a totally based on Inheritance, which can be of two types Class Inheritance or Interface Inheritance. It is just like saying "A is a B type of thing". For example, Apple is a Fruit, Car is a Vehicle etc. Inheritance is uni-directional. For example, House is a Building. But Building is not a House.
It is a key point to note that you can easily identify the IS-A relationship. Wherever you see an extends keyword or implements keyword in a class declaration, then this class is said to have IS-A relationship.
30. a) automobile
Explanation: Automobile is the most generic class among all others, hence, it should be the base class.
31. d) prime numbers
Explanation: Prime numbers do not exhibit any hierarchial relationship.
NOTE: As per HOMEWORKLIB POLICY, I am allowed to answer only 4 questions (including sub-parts) on a single post. Kindly post the remaining questions separately and I will try to answer them. Sorry for the inconvenience caused.
27. Suppose the unary ! operator is an overloaded member function of class String. For a...
A) Suppose you have a class called base which has been inherited by a class called derived. ( both classes have public, protected and private members ) What can a client of derived access within the class base ? What can the class derived access within the class base ? B) Suppose you have a class called more which has a private object of a class called simple. ( both classes have public, protected and private members...
Create the class Book which has the following members: 1. private members: 1. title as String 2. isbn as String 3. author as String 4. price as double 2. public members: 1. default constructor which initializes all data members to their default values. 2. non-default constructor which initializes all data members to parameters values. 3. toString which returns a representing String of the Book. 4. add all the setters and getters. Create the class EBook which is a subclass of...
In Java Which of the following statements declares Salaried as a subclass of payType? Public class Salaried implements PayType Public class Salaried derivedFrom(payType) Public class PayType derives Salaried Public class Salaried extends PayType If a method in a subclass has the same signature as a method in the superclass, the subclass method overrides the superclass method. False True When a subclass overloads a superclass method………. Only the subclass method may be called with a subclass object Only the superclass method...
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...
please write the code in C++ 2 Base class File 3 Derived class PDF 3.1 Class declaration • The class PDF inherits from File and is a non-abstract class 1. Hence objects of the class PDF can be instantiated. 2. To do so, we must override the pure virtual function clone) in the base class • The class declaration is given below. • The complete class declaration is given below, copy and paste it into your file. . It is...
Overload a relational operator for the Job class: Assume that this operator is not overloaded for the Salary class. a) Write how the function will be declared in your code. b) Write an external function definition (not inside the class). solve it in C++10 to solve this you nedd question number 1. Create a composition between the classes Job and Salary. Class Salary a. data member: 1. money b. constructors: 1. default constructor 2. user defined constructor with a parameter...
Language: C++ Create an abstract base class person. The person class must be an abstract base class where the following functions are abstracted (to be implemented in Salesman and Warehouse): • set Position • get Position • get TotalSalary .printDetails The person class shall store the following data as either private or protected (i.e., not public; need to be accessible to the derived classes): . a person's name: std::string . a person's age: int . a person's height: float The...
(1) ____ is the principle that allows you to apply your knowledge of a general category to more specific objects. a. Inheritance c. Encapsulation b. Polymorphism d. Override (2) When you create a class by making it inherit from another class, you are provided with data fields and ____ automatically. a. fonts c. class names b. methods d. arrays (3) By convention, a class diagram contains the ____ following each attribute or...
Add an HourlyPlusCommissionEmployee class to the PayrollSystem app by subclassing an existing class. A HourlyPlusCommissionEmployee is a kind of CommissionEmployee with the following differences and specifications: HourlyPlusCommissionEmployee earns money based on 2 separate calculations: commissions are calculated by the CommissionEmployee base class hourly pay is calculated exactly the same as the HourlyEmployee class, but this is not inherited, it must be duplicated in the added class BasePlusCommissionEmployee inherits from CommissionEmployee and includes (duplicates) the details of SalariedEmployee. Use this as...
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:...