G
Guest
Hi,
I have a question regarding the typecasting.
I have a class A with some properties and methods... I also have a copy of
same class as class B. Class A and B are having every thing same just a name
change and namespace change.
Now I want to have a code like this
A a = new A();
B b= new B();
b= a;
obviously this will give me error..
so I am writing b = (B) a;
This also gives me type cast error. how ever I assume that I need to write
some code in both classes so that they can be converted to each other. I am
thinking to serilize and de-serilize but this would be unnecessary overhead.
I am sure there must be some way exists which will allow me to do this.
Regards,
Kishor
I have a question regarding the typecasting.
I have a class A with some properties and methods... I also have a copy of
same class as class B. Class A and B are having every thing same just a name
change and namespace change.
Now I want to have a code like this
A a = new A();
B b= new B();
b= a;
obviously this will give me error..
so I am writing b = (B) a;
This also gives me type cast error. how ever I assume that I need to write
some code in both classes so that they can be converted to each other. I am
thinking to serilize and de-serilize but this would be unnecessary overhead.
I am sure there must be some way exists which will allow me to do this.
Regards,
Kishor