|
|
|
Re: [XCore] Overriding implementation of a super class feature in a subclass [message #891885 is a reply to message #891883] |
Tue, 26 June 2012 12:33 |
Ed Merks Messages: 33236 Registered: July 2009 |
Senior Member |
|
|
Roland,
Yes, that's the idea.
On 26/06/2012 2:28 PM, Roland Tepp wrote:
> Thanks Ed for quick reply,
>
> My comments below as well:
>
> 25.06.2012 18:38, Ed Merks kirjutas:
>>> I would also like to provide the abstract "type" feature in the base
>>> class that would return the value of the "type" column of the table.
>> And it must be a feature, i.e., an operation won't suffice?
>
> I suppose, an operation would do just as well... Feature would simply
> "look better" in this context.
>
>>> Essentially the value of the Type feature would be constant for a
>>> particular subclass, but I can not specify an override for a feature
>>> (xcore reports an error when I try to specify a field that is already
>>> defined for a superclass)
>> You should be able to define an operation that has the same name as the
>> accessor method for the feature.
>
> Okay, so let me confirm that I understand it correctly:
>
> I can define:
>
> enum Type {
> ONE
> TWO
> THREE
> ...
> }
>
> abstract class Base {
> ...
> derived transient readonly Type ^type
> ...
> }
>
> class One extends Base {
> ...
> op Type getType(){
> return Type::ONE
> }
> ...
> }
> etc.
>
> It looks like a hackish solution, but it seems to work well enough.
> Thanks :)
>
>
> Roland
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.23620 seconds