answersLogoWhite

0

How can inheritance be modeled?

Updated: 8/11/2023
User Avatar

Wiki User

12y ago

Best Answer

Inheritance is the Java object oriented feature wherein functionality in one class is inherited or available for use in another class. It can be compared to parent-child relationships.

1. Single Inheritance

A Scenario where one class is inheriting/extending the behavior of just one super class.

Ex: public class Ferrari extends Car {…}

2. Multilevel Inheritance

A Scenario where one class is inheriting/extending the bahavior of another class which in turn is inheriting behavior from yet another class.

Ex: public class Automobile {…}

Public class Car extends Automobile {…}

Public class Ferrari extends Car {…}

This multilevel inheritance actually has no limitations on the number of levels it can go. So as far as java goes, it is limitless. But for maintenance and ease of use sakes it is better to keep the inheritance levels to a single digit number.

3. Multiple Inheritance

Actually, java does not support multiple inheritance. You can achieve partial multiple inheritance using interfaces but java is not like C or C++ where you can do direct multiple inheritance. However, you can achieve partial multiple inheritance with the help of interfaces.

Ex: public class FerrariF12011 extends Ferrari implements Car, Automobile {…}

And this is under the assumption that Car and Automobile are interfaces.

Here if you see, though you don't inherit concrete code from the Car or the Automobile interface, you do inherit skeleton methods that determine the way your class eventually behaves and hence this can be considered partial Multiple Inheritance.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

Yeah because inheriting is physical visibility so I it modeled

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can inheritance be modeled?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What was we the people modeled after?

It was modeled after the Iroquois treaty.


What is a inheritance?

In Software design, inheritance means a design methodology which includes deriving one class such that it acquires properties of another class. This terminology is modeled after real-life inheritance.In real life, inheritance refers to the passing of ownership of assets from a deceased person to a living person. For example, your father might have stated in his testament that the family home goes to the eldest son, while the collection of classic cars goes to the youngest son. The house thus is the first-born son's inheritance, the classic car collection the second son's inheritance.


What geometric figures are modeled by the stars?

Points are modeled by stars.


A real word sutuation that can be modeled?

Fraction is a word that can be modeled. This is used mostly in math.


The Statue of Liberty's face was said to be modeled after the sculptors what?

The statue of liberty was modeled after Athena


Which Native American Nation was the Articles of Confederation modeled after?

The Articles of Confederation was modeled after the Iroquois league.


What is the name of the cartoon character modeled after Clara bow?

Betty Boop was modeled after Clara Bow .


What actors and actresses appeared in Modeled - 2011?

The cast of Modeled - 2011 includes: Don Bapst


Does hybrid inheritance consist of ANY two types of inheritance?

There are only two types of inheritance to begin with: single inheritance and multiple inheritance. Since they are mutually exclusive there is no such thing as hybrid inheritance.


Who was excella gionne modeled after?

The character Excella Gionne, in Resident Evil 5, was modeled after Nina Fehren.


The Founding Fathers modeled the US Congress on what governing body?

It was modeled after "British Parliament".


Is a cash inheritence community property?

No. An inheritance is separate property.No. An inheritance is separate property.No. An inheritance is separate property.No. An inheritance is separate property.