Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Posts
    127

    Unanswered: Type Inheritance attribute limitor

    Hi, is there at all any way to provide a mechanism to limit certain attributes of a parent type which is part of an inheritance model from being inherited from a child type. For instance, to limit the type just use FINAL, although this cannot be used on an attribute of the type, im searching for a way to do so. is there any possible solution? ive checked the relevent lit on 9i - to no avail






  2. #2
    Join Date
    Sep 2004
    Location
    London, UK
    Posts
    565
    Presumably if an attribute of a type were final, no valid child type could be created anyway.

    Is this a feature of other OO languages?

  3. #3
    Join Date
    Apr 2004
    Location
    Toronto, Canada
    Posts
    249
    WilliamR wrote:
    Presumably if an attribute of a type were final, no valid child type could be created anyway.
    Since that is a reasonable assumption, if an OO hierarchy exists with non-inheritable attributes, then the design is simply wrong.

    It is possible that by final you mean to say that the attribute may be modified only by the parent, never by the children. If so, then create a private variable, assign public final setter methods to it, and the usual getter method. This way, the value can be changed only by the parent, never by the child. Yet it is accessible to everybody. Of course, this is applicable only to Java. In C++ you'd use "virtual" to let methods be over-ridden.

    WilliamR said:
    Is this a feature of other OO languages?
    This is a feature of Java. Other OO languages, like Python and Ruby, do not have the concept of private variables.

    As far as I know, there is no way of doing this in current databases, especially since this design would be simply wrong.

    Ravi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •