HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

vJASS - Structs - Advanced Question

09-08-2009, 07:26 AM#1
Anachron
Hey.

I have a little question.

How/Can I do this:

Collapse JASS:
struct A 
   public stub method test takes nothing returns nothing
   endmethod
endstruct

struct B extends A
   public stub method test takes nothing returns nothing
   endmethod
endstruct

struct C extends B
   public method test takes nothing returns nothing
      call BJDebugMsg("Test")
   endmethod
endstruct

Basicly, I want to have a basic interface which every of these structs have.
Then, the B class has a few new methods, which C also has. C will additionally overwrite some of Bs stub methods.
09-08-2009, 07:40 AM#2
Earth-Fury
Quote:
Originally Posted by Anachron
Hey.

I have a little question.

How/Can I do this:

Collapse JASS:
struct A 
   public stub method test takes nothing returns nothing
   endmethod
endstruct

struct B extends A
   public stub method test takes nothing returns nothing
   endmethod
endstruct

struct C extends B
   public method test takes nothing returns nothing
      call BJDebugMsg("Test")
   endmethod
endstruct

Basicly, I want to have a basic interface which every of these structs have.
Then, the B class has a few new methods, which C also has. C will additionally overwrite some of Bs stub methods.

That's exactly how it's done..

Methods from parents extend to children. Stub methods can be overridden in children, non-stub methods can not. Interfaces are collections of stub methods alongside fields.
09-08-2009, 08:53 AM#3
Anachron
I see. Good, I just wanted to know. :)