I'd like to type cast from a base class to a derived class. For example:
class A {}; class B : public A {} A a; // do stuff with a B b = (B)a;
This works fine with B* b = (B*)&a; but I'm trying to avoid that. Is this possible?
B* b = (B*)&a;
没有评论:
发表评论