Inherited const when you need to mutate
Jacob Carlborg
doob at me.com
Wed Jul 11 02:43:34 PDT 2012
On 2012-07-11 02:20, Timon Gehr wrote:
> I for one would be satisfied if inheriting from object became optional:
>
> // object.di
> class RawObject /+ this is the root of the class hierarchy +/{ }
> class SynchronizableObject : RawObject { void* monitor; }
> class Object : SynchronizableObject {
> const { stuff }
> }
>
> // user code
> class NoCruft : RawObject {
> // ...
> }
>
Ruby 1.9 is doing something similar.
class BasicObject
end
class Object < BasicObject
end
class Foo # inherits from Object
end
class Bar < BasicObject # inherits from BasicObject
end
I wonder if the same can be done, with the now base class protection, in D:
class RawObject : private Object
{}
class Foo : RawObject
{}
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list