How do interface implementations work?
From: Rob Kennedy (.)
Date: 10/30/03
- Next message: Martin James: "Re: Thread Syncronization methods"
- Previous message: Jerry: "Re: Memory Leak"
- Next in thread: Marc Rohloff: "Re: How do interface implementations work?"
- Reply: Marc Rohloff: "Re: How do interface implementations work?"
- Reply: Greg Chapman: "Re: How do interface implementations work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Oct 2003 22:59:50 -0600
Howdy
When a class implements an interface, how can it access its fields from
within the method implementations? To access a field, the compiler
calculates the field's offset from Self, right? Self^ holds the address
of the VMT, (Self+4)^ holds the first data field, etc.
Normally, when you call a method on an object reference, the object
reference gets passed in the EAX register, which is interpretted as Self
inside the method. As I understand it, calling a method via an interface
reference works the same way, but that would mean EAX holds that
interface reference instead of the object reference. How is it that we
are still able to access fields and call virtual methods without being
given a proper Self pointer?
-- Rob
- Next message: Martin James: "Re: Thread Syncronization methods"
- Previous message: Jerry: "Re: Memory Leak"
- Next in thread: Marc Rohloff: "Re: How do interface implementations work?"
- Reply: Marc Rohloff: "Re: How do interface implementations work?"
- Reply: Greg Chapman: "Re: How do interface implementations work?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|