Aquila Deus wrote:
Hi all!
I wondering if there is any method to override object/class within a
context, like this:
<snip>
If I understand correctly, you're asking if you can override this kind
of statement:
SomeType x = new SomeType();
to actually produce an SomeOtherType object instead, and the answer is
yes, you do it like this:
SomeType x = new SomeOtherType();
of course, this means SomeOtherType must descend from SomeType.
Now, if I understand the full question correctly, you're asking if you
can ask methods you call from your code do the same substitution
automatically, ie. every place they do the first statement they should
do the second statement instead, then the answer is no.
--
Lasse Vågsæther Karlsen
http://www.vkarlsen.no/
mailto:la***@vkarlsen.no
PGP KeyID: 0x0270466B