class - Object-languages misdescribed by UML? -


i've read uml assumes default :

  1. a class can inherit several others
  2. an object instance of 1 class
  3. an object of given class cannot change class

this leads me question : there 3 hypothesis, there 2^3 possible combinations. give me languages examples of each of them ?

i mean me java "false-true-true" , c++ "true-true-true". 6 others ? or did misinterpret assumptions ?

let's @ uml 2.5 standard of omg, have definitive answer:

1.class inheritance

the uml 2.5 standard defines class can have none or several superclasses and, conversely, class can superclass of none or several classes (see section 11.4.2 , 11.8.3.6).

so uml definitively allows multiple inheritance (as in c++ or python). may restrict , use single inheritance , several interface implementations, in java , c#. you'd use realization relationship show "inheritance" abstract interface (the inheritance arrow dotted).

2. objects , classes

9.8.1: instancespecifications represent instances of classifiers in modeled system. used model example configurations of instances.

fyi: terms used in standard little more general, object instance, , class classifier. definition further refined in semantcs in chapter 9.8.3 :

the instancespecification may represent:
• classification of instance one or more classifiers, of may abstract.

so uml allows objects instantiation of several classes. don't know languages allow this, if don't hesitate comment ;-).

3. changing class of object

i must admit can't answer answer 100%. don't think so, because, becoming instance of class mean re-insantiate class, it's not corresponding anymore definition of instantiation.
furthermore (see 9.8.3):

an instancespecification may represent instance @ point in time (a snapshot). changes instance may modeled using multiple instancespecification, 1 each snapshot.

this ambiguous: given object in given diagram can't change classes. however, can represent several times object in different diagrams (snapshot) show change.

conclusions

so assumption 1 true, 2 false, , 3 true or false depending if you're reasoning @ diagram or model level.


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -