Interfaces can be marshaled by value. For an interface marshaled by value (as opposed to a class instance derived from that interface), only the type ID of the most-derived interface is encoded. Here are the Slice definitions once more:
interface Base { /* ... */ }; interface Derived extends Base { /* ... */ }; interface Example { void doSomething(Base b); };
If the client passes a class instance to doSomething
that does not have a Slice definition (but derives from Derived
), the on-the-wire representation of the interface is as follows:
Marshaled Value |
Size in Bytes |
Type |
Byte offset |
---|---|---|---|
|
4 |
|
0 |
|
1 |
|
4 |
|
10 |
|
5 |
|
4 |
|
15 |
|
1 |
|
19 |
|
14 |
|
20 |
|
4 |
|
34 |
|
1 |
|
38 |