これがシナリオです:
class Base {
public:
typedef Base type;
};
class Derived: public Base {
public:
typedef Derived type;
};
私は次のようなものが欲しいです:
int main() {
Base * bs = new Derived();
decltype(*bs)::type newvar;
}
静的/動的キャストを使用せずに、上記のような方法でDerivedクラスのタイプを取得するにはどうすればよいですか?