G
Guest
Hi every one.
I have two class: MyBase and MySon. MyBase is the base class of MySon. On
the other hand I have two interface: MyBaseItef and MySonItef. MyBaseItef is
the base interface of MySonItef. Now there has a GetMyClass method in
MyBaseItef liek: MyBase GetMyClass() in C#. If some class implement MySonItef
it must has GetMyClass Method. But the instance type of the return value is
MySon. Must I define an other method or use "new" keyword to override and
shadow the method in the base interface to change the type of the return
value. If I use "new" keyword, it must implement two methods of bouse
MyBaseItef and MySonItef in the class. And when some program load the
GetMyClass() method, both of the methods will be load. Who know how to change
the type of the return and not use "new" keyword and not use two method names.
Thanks.
Steven
13rd Dec 2004
I have two class: MyBase and MySon. MyBase is the base class of MySon. On
the other hand I have two interface: MyBaseItef and MySonItef. MyBaseItef is
the base interface of MySonItef. Now there has a GetMyClass method in
MyBaseItef liek: MyBase GetMyClass() in C#. If some class implement MySonItef
it must has GetMyClass Method. But the instance type of the return value is
MySon. Must I define an other method or use "new" keyword to override and
shadow the method in the base interface to change the type of the return
value. If I use "new" keyword, it must implement two methods of bouse
MyBaseItef and MySonItef in the class. And when some program load the
GetMyClass() method, both of the methods will be load. Who know how to change
the type of the return and not use "new" keyword and not use two method names.
Thanks.
Steven
13rd Dec 2004