Microsoft Word OpenIssuesInOO. doc

  Single and multiple inheritance

Download 1.28 Mb.
Pdf ko'rish
Hajmi1.28 Mb.
1   ...   17   18   19   20   21   22   23   24   ...   51

Single and multiple inheritance 

Since the early days of Simula, multiple inheritance is perhaps the issue that has been 

discussed mostly in the object-oriented community. There are people who think that 

multiple inheritance is a central element of object-oriented programming whereas other 

people think it should be avoided since it easily leads to complicated inheritance graphs. 

If reuse of code is a major concern, then multiple inheritance is a technical solution to 

combining classes into new classes and to inherit the 'useful' parts and redefine whatever 

needs to be redefined. Multiple inheritance may be a quick way to write new code based on 

existing code. The disadvantage of multiple inheritance is that the inheritance structure 

express an evolution of the class hierarchies and the class/subclass relation does not express 

a conceptual relation.  

A number of examples where multiple inheritance is used are often examples where 

composition/aggregation may be more natural. However, due to the poor support for 

composition in most object-oriented languages, people use multiple inheritance instead. 

As mentioned, inheritance may from a modeling point of view  be used to represent 

classification hierarchies. A classification or taxonomy is often tree structured since the 

phenomena being classified are grouped into disjoint classes. Tree structured classification 

hierarchies have been used within science for centuries to organise knowledge. However, as 

mentioned in section 3, everyday concepts may not easily be described as Aristotelian 

concepts organised in a tree structure and there are a number of examples where it is useful 

to organise concepts in a non-tree structured way and this is of course supported by multiple 


From a modeling point of view, multiple inheritance is useful in the cases where  there is 

a need to represent a non-tree structured classification hierarchy. However, many so-called 

'modeling' examples of multiple inheritance are really examples of a combination of two or 

more independent tree structured classification hierarchies. There is often a need to classify 

a set of phenomena according to several properties. A group of people may be classified 

according to their profession, nationality, religion, etc. and each of these classifications may 

be expressed by means of a tree structured classification hierarchy. This is called multiple 

classification. There is, however, no programming language that is able to directly represent 

multiple classification. Instead multiple inheritance may be used, but a multiple inheritance 

hierarchy does not properly represent this, since it is not possible to identify the original tree 

structured hierarchies. 

To sum up: single inheritance is well suited for representing tree structured classification 

hierarchies. It would be desirable to have language support for representing multiple 

classification hierarchies including non-tree structured hierarchies, but multiple inheritance 

as found in most languages does not seem to be the solution. For BETA it was decided not 

to include multiple inheritance since it is not the right mechanism for modeling multiple 

classifications and since it seems technically complicated as a mechanism for reuse. Finally 

the generality of BETA with respect to block structure, part objects and singular objects 

may be used to handle a number of cases where multiple inheritance is used in other 

languages. Examples of this are shown in the next section. 

Download 1.28 Mb.

Do'stlaringiz bilan baham:
1   ...   17   18   19   20   21   22   23   24   ...   51

Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan © 2020
ma'muriyatiga murojaat qiling

    Bosh sahifa
davlat universiteti
ta’lim vazirligi
maxsus ta’lim
O’zbekiston respublikasi
zbekiston respublikasi
axborot texnologiyalari
o’rta maxsus
guruh talabasi
nomidagi toshkent
davlat pedagogika
texnologiyalari universiteti
xorazmiy nomidagi
toshkent axborot
pedagogika instituti
haqida tushuncha
rivojlantirish vazirligi
toshkent davlat
Toshkent davlat
vazirligi toshkent
tashkil etish
matematika fakulteti
ta’limi vazirligi
samarqand davlat
kommunikatsiyalarini rivojlantirish
bilan ishlash
pedagogika universiteti
vazirligi muhammad
fanining predmeti
Darsning maqsadi
o’rta ta’lim
navoiy nomidagi
haqida umumiy
Ishdan maqsad
fizika matematika
nomidagi samarqand
fanlar fakulteti
moliya instituti
sinflar uchun
maxsus ta'lim
Nizomiy nomidagi
ta'lim vazirligi
Ўзбекистон республикаси
universiteti fizika
umumiy o’rta
Referat mavzu
таълим вазирлиги
respublikasi axborot
Toshkent axborot
Alisher navoiy
махсус таълим
Buxoro davlat