answersLogoWhite

0

Inheritance is a means where a class borrows ("inherits") functionality from a base class, usually as a means of code reuse; the subclass will often add additional functionality or modify the behavior of the base class. Packages are simply a way of organizing code into namespaces, such that: Only classes that are actually part of the application logic are included, to prevent conflicts from classes that have the same name, and to logically organize code so that similar functionality can be grouped together.

User Avatar

Wiki User

12y ago

What else can I help you with?

Continue Learning about Engineering

Difference between composition and inheritance?

The 'is a' relationship is expressed with inheritance and 'has a' relationship is expressed with composition. Both inheritance and composition allow you to place sub-objects inside your new class. Two of the main techniques for code reuse are class inheritance and object composition. Inheritance [ is a ] Vs Composition [ has a ] Building Bathroom House class Building{ ....... } class House extends Building{ ......... } is a [House is a Building] class House { Bathroom room = new Bathroom() ; .... public void getTotMirrors(){ room.getNoMirrors(); .... } } is a has a [House has a Bathroom] has a Inheritance is uni-directional. For example House is a Building. But Building is not a House. Inheritance uses extends key word. Composition: is used when House has a Bathroom. It is incorrect to say House is a Java - Fundamentals 19 Bathroom. Composition simply means using instance variables that refer to other objects. The class House will have an instance variable, which refers to a Bathroom object.


What is the difference between an assembler and a translator?

what is the difference between an assembler and the translator


What is the difference between technology and process?

what is the difference between license and patent


What is the Difference between HVAC and AHU?

What is difference between hvac and ahu


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.

Related Questions

What is the difference between vertical and horizontal systems packages?

explain the difference berween vertical and horizontal system packages?


What is the difference between .RPM and .deb packages?

Check out the related links for information on the differences between .rpm and .deb packages.


Is there a difference between estate being willed to you or inheritance?

No. Property that you receive by a will IS an inheritance. Property received from a relative under the laws of intestacy when there was no will is also an inheritance.


What is the home insurance cost difference between companies?

Two different companies may offer different home insurance packages for their employees. The difference between such packages is determined by the revenue of the company in question and the value of the employee for the company.


What is the difference between death tax and estate tax?

Inheritance taxes and estate taxes differ only in who pays and to whom the tax is paid. Learn the differences between inheritance and estate taxes.


What is the difference between inheritance and earnings?

Inheritance is what you get if someone who dies has decided that you should have some of his/her belongings. Earnings are typically your salary, the pay you get for having done some work.


What is difference between bank and post office?

A bank handles money and a post office handles letters and packages.


Difference between program and package?

There are fundamental similarities and difference between computational programming and packages. A computer program are the set of instructions behind a specific application or software. A package is set of software programs.


What is the difference between epistasis and polygenic inheritance in genetics?

Epistasis is when one gene affects the expression of another gene, while polygenic inheritance involves multiple genes contributing to a single trait. Epistasis involves the interaction between genes, while polygenic inheritance involves the cumulative effect of multiple genes on a trait.


Difference between computer program and package?

There are fundamental similarities and difference between computational programming and packages. A computer program are the set of instructions behind a specific application or software. A package is set of software programs.


whats the difference between direct tv and dish tv?

There really is no difference between the two companies other than the price. Both offer the same basic packages, and the same service coverage areas.


What is one difference between tracing the inheritance of autosomal traits and tracing the inheritance of sex-linked traits?

One key difference is that autosomal traits are located on the autosomes (non-sex chromosomes), while sex-linked traits are located on the sex chromosomes (X or Y). This difference affects how these traits are inherited and expressed, as sex-linked traits show different inheritance patterns among males and females.