Oberon Community Platform Forum

Development => ETH Zonnon => Topic started by: danp on May 28, 2008, 06:22:19 PM



Title: Inheritance
Post by: danp on May 28, 2008, 06:22:19 PM
Hello,

I have an object that extends System.Xml.XmlDocument that works fine:

module Util;
type {public, ref} RecordSet = object (data : XmlElement) implements XmlDocument

but I should like to extend it again in another module like this:

module Db;
type {public, ref} RecordSet = object (data : XmlElement) implements Util.RecordSet

and this is not valid. How can I manage that? There is a confusing sentence in section 10.2.1 of the Language Report: "If an object B refines an object A, then B is said to be derived from A". Could an object refines another object? Only definitions could be refined.

Thanks,
Dan


Title: Re: Inheritance
Post by: rmitin on June 03, 2008, 04:06:48 PM
Hi Dan,

only definitions can be refined. Objects in Zonnon are what sealed objects in C# or final objects in Java. If you want to refine it later you need to create a pair definition + implementation, then refine it and then create two (sealed/final) objects when which you will actually use.

Roman


Title: Re: Inheritance
Post by: danp on June 06, 2008, 10:36:50 PM
Hi Roman,

I have understood the Zonnon internal definition + implementation mechanism which is great, but how can I resolve my case? As I could intend, the .Net class is considered as a default implementation, and it could be extended only by the object witch implements it. But is frustrating to not be able to extend it more.

Thank you,
Dan