G
Guest
Hello,
I've got a problem and I'm not sure if it is an understanding problem of
class behavior. I searched in the newsgroup and I found some Information
about the same topic, but actually no solution. So sorry for the repost, but
I would glad, if somebody could explain it to me.
/* begin code */
public class a {
}
public class b : a {
}
public class c {
a a_obj = new a();
b b_obj = new b();
// This is the important point
b = (b) a;
}
/* end code */
My problem: In csharp I get a cast Exception. The same thing in VB.NET works
fine. Why is that so and how can I do a workaround?
MfG
Georg Fleischer
I've got a problem and I'm not sure if it is an understanding problem of
class behavior. I searched in the newsgroup and I found some Information
about the same topic, but actually no solution. So sorry for the repost, but
I would glad, if somebody could explain it to me.
/* begin code */
public class a {
}
public class b : a {
}
public class c {
a a_obj = new a();
b b_obj = new b();
// This is the important point
b = (b) a;
}
/* end code */
My problem: In csharp I get a cast Exception. The same thing in VB.NET works
fine. Why is that so and how can I do a workaround?
MfG
Georg Fleischer