Best Answer

In database design, object-oriented programming, and knowledge representation, we often describe the relationship between two things as either "is-a" or "has-a" (but not both).

For example,

An avocado "is-a" fruit. (An avocado is a specific kind of fruit. A fruit is a generalization of things like an avocado. An avocado has all the things and characteristics that all fruit have -- an outer skin, an edible flesh, grows on plants, etc.)

An avocado "has-a" seed. (An avocado contains a seed. The seed is one of several parts of an avocado.)

(Many people find this "is-a" term more understandable than the terms "meronym" and "hyponym").

When writing computer programs, confusing these two kinds of relationships is a common source of bugs.

The "is-a" relationship is often represented in a program using "class inheritance", subclasses (and superclasses).

The "has-a" relationship is often represented in a program using a class variable.

The class variable is typically a basic type for exclusive things, such as "birthday".

The class variable is typically a reference to a class as a class variable for shared items, such as "mother".

User Avatar

Wiki User

โˆ™ 2011-11-07 11:22:22
This answer is:
User Avatar
Study guides

What is a programming language

What does DOS stand for

What is a software that is distributed for free

What is application software

See all cards
42 Reviews

Add your answer:

Earn +20 pts
Q: What is difference between an is-a relationship and a has-a relationship?
Write your answer...
Still have questions?
magnify glass
Related questions

What is difference between a firewall and ISA server?


Difference between beach tourism and island tourism?

Isa phoda

The difference between a developing nation and a developed nation?

the difference is that a devolpoo isa apop and it is a crapaoli and firdgt njghwg98gwhnwjkh

What is the relationship between computer science and computer programing?

Computer science isa science which give knoweledge to us.but the computer programing is a program that we are created to operate computer.that is the difference between the computer science and computer programming.

What is the difference between oration and declamation?

kupal din smagto ung isa jan...hahahaha.. gago

What is the the distance between Mount Isa and Rockhampton?

The road distance between the cities of Mount Isa and Rockhampton is 1334 km.

What is the difference between an ISA slot and a PCI slot?

An ISA slot runs at 8 MHz and has a bus width of 8 or 16 bits. PCI runs at 33 or 66 MHz and has a 32-bit or 64-bit bus width. So PCI is much faster than ISA.

How far is it between Adelaide and Mt Isa?

According to Google, the distance between Adelaide and Mt Isa, if traveling on roads is 1883km.

What actors and actresses appeared in In Between Days - 2009?

The cast of In Between Days - 2009 includes: Isa Campo as Isa Campo

What town in Queensland is between Mt Isa and Townsville?

There are a number of towns between Mt Isa and Townsville, but one of the bigger towns is Charters Towers.

What is the difference between ISA and PCI slots?

Physically, PCI slots are light-colored (usually white) and much smaller than the black ISA slots. Computationally, PCI technology was designed to automatically assign address information to the hardware plugged into it. This was a vast improvement over ISA technology which required a considerable amount of manual configuration.

What is imma isa isa?


People also asked