Can we say that if class A inherits from class B, class B will be - ProProfs Discuss
Topics
Products
Follow Us:

Can we say that if class A inherits from class B, class B will be modified by inheritance?

This question is part of

Programare.5
Asked by Mansfield, Last updated: Jul 01, 2020

+ Answer
Request

2 Answers

Barry Mclean

Ask me anything!

Barry Mclean, Sales Manager, MBA, Ewa

Answered Dec 26, 2018

No. This is false. According to the previous answer, this is because of the wording of the problem. If class A is inheriting from class B, then class A will be affected by whatever they’re inheriting. Class B will remain pretty much the same. It also comes down to the terminology that would be affixed to these classes; class B is your parent class, and class A is the child class.

For those who aren’t as tech savvy as others, this is kind of like the way we inherit traits from our parents. My parents have blue and hazel eyes, respectively.

My siblings and I all have blue eyes, and strikingly so. We cannot have brown eyes because neither of my parents has brown eyes. If Class B doesn’t have something, there’s no way class A can have it either.

 

John Smith

John Smith

Answered Sep 09, 2016

False- definition [inheritance] inheritance is a mechanism which allows a class a to inherit members (data and functions) of a class b. we say a inherits from b. objects of class a thus have access to members of class b without the need to redefine them. inheritance is identified by the phrase: kind-of at class level (circle is a kind-of shape) is-a at object level (the object circle1 is-a shape.) b is called superclass, supertype, base class or parent class. a is called subclass, subtype, derived class or child class. base classes are not touched in any way by inheritance.
 

Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer
Search for Google images
Select a recommended image
Upload from your computer

Email Sent
We have sent an email to your address "" with instructions to reset your password.