Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ implement using only inheritance the basic aim of the questiin is to test the conceot of inheritance so please implement using only inheritance thanks

c++
implement using only inheritance image text in transcribed
image text in transcribed
the basic aim of the questiin is to test the conceot of inheritance so please implement using only inheritance thanks
Task1: Write a program that declares two classes one is Student and other is Teacher. You can use any three attribute of each class and also member functions and implement given type of inheritance: Public inheritance Private inheritance Protected inheritance What you can learn through this program write here three lines according to this task in comment. Task 2: Write a program that declares two classes. The parent class is called Simple that has two data member a and b to store two numbers. It also has four member functions Addo) Sub() Mull Divo) The child class is called Complex that overrides all four functions. Each function in the child class checks the value of data members. It calls the corresponding member function in the parent class if the values are greater than 0. Otherwise it displays the error message. Task3: Write a class Person that has attributes of id, name and address. It has a constructor to initialize a member function to input and a member function to display data members. Create 2nd class Student that inherits Person class. It has additional attribute of roll number and marks. It also has member functions to input and display it data members. Create 3 class Scholarship that inherits Student class. It has additional attribute of scholarship name and amount. It also has member functions to input and display its data members. Task 4: Write class LocalPhone that contains an attribute phone to store a local telephone number. The class contains member functions to input and display phone number. Write a child class NatPhone for national phone numbers that inherits LocalPhone class. It additionally contains an attributes to store city code. It also contains member function to input and show the city code. Write another class IntPhone for international phone numbers that that inherits NatPhone class. It additionally contains an attribute to store country code. It also contains member functions to input and show the country code. Member functions Constructor Setters and getters

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions