Book a Demo

Author Topic: Is an object more than a instance of a class?  (Read 5684 times)

Legacy_Code

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Is an object more than a instance of a class?
« on: May 30, 2005, 06:14:14 am »
hi,

Object is considered as an instance of a class. But can we consider an object as a child of a parent class (sort of an inheritance)?

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Is an object more than a instance of a class?
« Reply #1 on: May 30, 2005, 07:17:53 am »
Quote
hi,

Object is considered as an instance of a class. But can we consider an object as a child of a parent class (sort of an inheritance)?


Well, an object IS an instance of a class.  Thus the concept of inheritance (Generalization) in the UML sense is NOT applicable, since they are two different kinds of classifiers.  Inheritance is the process by which the more specialised classifier is granted access to the features of the more specialised classifier.

If you look at the way in which EA renders that idea (by creating two classes, adding a Generalization link between them and then making sure all inherited features are made visible Ctrl+Shift+Y) it should become clearer.    Add some features to one or other class and watch the rendering change.  

When you've got the hang of that.  Add an object to the diagram.  Make all features visible (Ctrl+Shift+Y).  See nothing is visible!  Now,  set the instance classifier using Ctrl+L - to the more specialized class.  See the object automatically takes on the detail of the class you referenced.  Do it again, change to another class.  That class's features now are visible - all without having to add the Generalization link!

Does that clarify matters?  If not, ask for further clarification.  We're all here to help.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!