How to change the class of an object dynamically in C#?
Posted
by codemonkie
on Stack Overflow
See other posts from Stack Overflow
or by codemonkie
Published on 2010-03-23T08:53:12Z
Indexed on
2010/03/23
10:23 UTC
Read the original article
Hit count: 325
c#
Suppose I have a base class named Visitor, and it has 2 subclass Subscriber and NonSubscriber.
At first a visitor is start off from a NonSubscriber, i.e.
NonSubscriber mary = new NonSubscriber();
Then later on this "mary" subscribed to some services, and I want to change the type of "mary" to Subscriber.
What is the conventional way to do that?
© Stack Overflow or respective owner