Override in inheritance chain
2 posts
• Page 1 of 1
Override in inheritance chain
Hi,
I have experienced some very unexpected and annoying behavior when dealing with an inheritance chain and a method that is supposed to be override in both subclasses. Here is a simple example:
Even if I additionally mark
Is this intended?
I have experienced some very unexpected and annoying behavior when dealing with an inheritance chain and a method that is supposed to be override in both subclasses. Here is a simple example:
- Code: Select all
:class BC
∇ sayHello
:access public overridable
'I'm the base class.'
∇
∇ speak
:access public
sayHello
∇
:endclass
:class SC1 : BC
∇ sayHello
:access public override
'I'm the first subclass.'
∇
:endclass
:class SC2 : SC1
∇ sayHello
:access public override
'I'm the second subclass.'
∇
:endclass
- Code: Select all
inst←⎕new SC2
inst.speak
⍝ inst says "I'm the first subclass."
⍝ Intuitively, I would expect "I'm the second subclass.", which is also what you would get in other programming languages.
Even if I additionally mark
- Code: Select all
sayHello
Is this intended?
- zaibot.w
- Posts: 6
- Joined: Mon Jun 29, 2020 4:09 pm
Re: Override in inheritance chain
Hi zaibot.w,
I think this may be a bug, so I will add your example to this issue:
7625: Multiple levels of the class keyword Override do not work.
Regards,
Vince
I think this may be a bug, so I will add your example to this issue:
7625: Multiple levels of the class keyword Override do not work.
Regards,
Vince
- Vince|Dyalog
- Posts: 429
- Joined: Wed Oct 01, 2008 9:39 am
2 posts
• Page 1 of 1
Return to Object Oriented Programming
Who is online
Users browsing this forum: No registered users and 1 guest
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group