Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
July 16, 2002 Interfaces | ||||
---|---|---|---|---|
| ||||
Can I override implementation of interfaces in inherited classes ? interface xyz { void doSomething(); } class abc: xyz { void doSomething() { // do something } } class ijk : abc { override void doSomething() { super(); // do more things } } Juarez Rudsatz |
July 17, 2002 Re: Interfaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | Yes, that should work. -Walter "Juarez Rudsatz" <juarez@nowhere.com> wrote in message news:Xns924DBBD86640Ajuarezcom@63.105.9.61... > Can I override implementation of interfaces in inherited classes ? > > > interface xyz > { > void doSomething(); > } > > class abc: xyz > { > void doSomething() > { > // do something > } > } > > class ijk : abc > { > override void doSomething() > { > super(); > // do more things > } > } > > > Juarez Rudsatz |
July 17, 2002 Re: Interfaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | This is powerfull.
Even besser then Delphi Object Pascal Implementation.
"Walter" <walter@digitalmars.com> wrote in news:ah2n8m$3092$1 @digitaldaemon.com:
> Yes, that should work. -Walter
>
> "Juarez Rudsatz" <juarez@nowhere.com> wrote in message news:Xns924DBBD86640Ajuarezcom@63.105.9.61...
>> Can I override implementation of interfaces in inherited classes ?
>>
>>
>> interface xyz
>> {
>> void doSomething();
>> }
>>
>> class abc: xyz
>> {
>> void doSomething()
>> {
>> // do something
>> }
>> }
>>
>> class ijk : abc
>> {
>> override void doSomething()
>> {
>> super();
>> // do more things
>> }
>> }
>>
>>
>> Juarez Rudsatz
|
July 19, 2002 Re: Interfaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | I think Delphi, as well as C++ and Java all allow this. By the way, shouldn't it be this: class abc: Object, xyz // Inherit from Object { void doSomething() { // do something } } Or is Object automatically assumed as ancestor when the first 'class' in the inheritance list is in fact an interface? -- Stijn OddesE_XYZ@hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail |
July 19, 2002 Re: Interfaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to OddesE | Delphi, don't allow inherited interfaces be overrided.
I do not know how Java does...
"OddesE" <OddesE_XYZ@hotmail.com> wrote in news:ah9629$2ari$1 @digitaldaemon.com:
> I think Delphi, as well as C++ and Java all
> allow this.
>
> By the way, shouldn't it be this:
>
> class abc: Object, xyz // Inherit from Object
> {
> void doSomething()
> {
> // do something
> }
> }
|
July 20, 2002 Re: Interfaces | ||||
---|---|---|---|---|
| ||||
Posted in reply to Juarez Rudsatz | "Juarez Rudsatz" <juarez@nowhere.com> wrote in message news:Xns92508BEABA330juarezcom@63.105.9.61... > Delphi, don't allow inherited interfaces be overrided. > I do not know how Java does... > I thought it does as long as the implementing method is defined as public or protected? I can hardly imagine this would not be possible! -- Stijn OddesE_XYZ@hotmail.com http://OddesE.cjb.net _________________________________________________ Remove _XYZ from my address when replying by mail |
Copyright © 1999-2021 by the D Language Foundation