Trass3r wrote:
Cast the instance to the base class and call the method?
Surprisingly this does compile.
What are the rules for casting between classes?
Normally you can cast A to B if B inherits from A. But this seems not to
be the case in D. The following compiles without complains:
impo
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Trass3r wrote:
>> Cast the instance to the base class and call the method?
>>
>
> Surprisingly this does compile.
> What are the rules for casting between classes?
I don't think there are any rules as such.
Casting in D is not well specified.
Betwe
> Cast the instance to the base class and call the method?
>
Surprisingly this does compile.
What are the rules for casting between classes?
On 3/6/10 13:39, Trass3r wrote:
I got 2 classes which both (indirectly) inherit from a common base class and
implement a certain interface I.
Now I need to pass that interface to a function and need to call a function
inherited from the base class inside.
Naturally that function is not presen
Trass3r:
> I got 2 classes which both (indirectly) inherit from a common base class and
> implement a certain interface I.
When possible show an example. You can fill/fix the following code to create an
example of your problem:
interface IFoo {
void foo();
}
class Base {
void foo() {}