In 3.5 you can't do this. In 4.0 you need to understand covariance.

-- 
Regards,
Mark Hurd, B.Sc.(Ma.)(Hons.)

On 5 November 2010 23:33, Wolfgang Von Steinberg <[email protected]> wrote:
> Hello List,
>
> I am trying to get something working, here is the basic idea,
>
> Given following declarations:
> interface IData;
> interface IPerson extends IData;
> class Person implements IPerson ;
> interface IPersistor<T> {  void Persist(T item) }
> class PersonPersistor implements IPersistor<IPerson>;
> IPersistor<IData> genericPersistor = new PersonPersistor();  //Error here
> genericPersistor is null!! What Gives? after all IPerson is an IData !!
> genericPersistor.Persist( person );   // person is of a type that implements
> IPerson
> Also, Is/Are there any pattern(s) that would remotely resemble anything
> similar to what I am trying to achieve above?
>
> Any other suggestions?
>
> Thank you
>
> WVS

Reply via email to