>These problem can be stated in another way : how to create object B at the
>memory address of A?
You can't.
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
I'm not sure what you're trying to accomplish, but if you require that
you can do this often in your code you might consider a level of
indirection. That is, your objects that currently reference A (and you
want to reference B, which is possible since B derives from A) then they
should reference X, where X references A (or B). Class X would not be in
the inheritence chain derived from A. This would allow you to change
what X references while all the objects referencing X should get their
reference to the A base class from X.
This is similar to System.WeakReference, except that it serves a
different purpose in a similar manner.

Signature
Heath Stewart
Software Design Engineer
Developer Division Sustained Engineering
Microsoft Corporation
Lei Jiang - 03 Dec 2004 01:53 GMT
Thanks! In fact it's a design problem.
> I'm not sure what you're trying to accomplish, but if you require that
> you can do this often in your code you might consider a level of
[quoted text clipped - 7 lines]
> This is similar to System.WeakReference, except that it serves a
> different purpose in a similar manner.