Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ PLEASE, MUST USE STARTER CODE!! In object oriented programming classes can be related through inheritance. One class (the subclass class) can be derived from
C++ PLEASE, MUST USE STARTER CODE!!
In object oriented programming classes can be related through inheritance. One class (the subclass class) can be derived from another class (the base class). In java we would say the subclass ertends the base class. The subclass has all the members (functions and data) from the base class The subclass usually has more members and is a specialization of the base class. For example, a Date class might be derived from Time class. Then if the Time class has members for hour, minute and second, then the derived Date class could have members for day, month and year as well as hour, minute and second. Further, Appointment might be derived from Date with additional fields for location and name. This example, (pictured below), an instance of an appointment has fields for hour, minute and second. class Time class Date public Time class Appointment : public Date public: public: public: int hour; int minute; int second; int day; int month; int year; string location; string name; Figure 1 Inheritance in C+ classes. Note that this relationship is transitive. In other words if A extends B and B extends C then A extends C. Also note that a class can inherit from multiple classes In this problem you will be given a set of extension relationships and a set of queries of the form A extends B or A isExtendedBy B. You must determine if each query is true or false Part 1 Due Feb 20 Input: Input starts with one integers n (1 n), where n specifies the number of given eztends The next n lines each contain one given relationship in the form c c2 where c and c2 are single-word class ameS In object oriented programming classes can be related through inheritance. One class (the subclass class) can be derived from another class (the base class). In java we would say the subclass ertends the base class. The subclass has all the members (functions and data) from the base class The subclass usually has more members and is a specialization of the base class. For example, a Date class might be derived from Time class. Then if the Time class has members for hour, minute and second, then the derived Date class could have members for day, month and year as well as hour, minute and second. Further, Appointment might be derived from Date with additional fields for location and name. This example, (pictured below), an instance of an appointment has fields for hour, minute and second. class Time class Date public Time class Appointment : public Date public: public: public: int hour; int minute; int second; int day; int month; int year; string location; string name; Figure 1 Inheritance in C+ classes. Note that this relationship is transitive. In other words if A extends B and B extends C then A extends C. Also note that a class can inherit from multiple classes In this problem you will be given a set of extension relationships and a set of queries of the form A extends B or A isExtendedBy B. You must determine if each query is true or false Part 1 Due Feb 20 Input: Input starts with one integers n (1 n), where n specifies the number of given eztends The next n lines each contain one given relationship in the form c c2 where c and c2 are single-word class ameS
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started