Re: interface problem

2010-03-08 Thread Ary Borenszweig
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

Re: interface problem

2010-03-06 Thread div0
-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

Re: interface problem

2010-03-06 Thread Trass3r
> Cast the instance to the base class and call the method? > Surprisingly this does compile. What are the rules for casting between classes?

Re: interface problem

2010-03-06 Thread Jacob Carlborg
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

Re: interface problem

2010-03-06 Thread bearophile
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() {}