C++ empty class or typedef

c++, class, typedef

Solution

It depends. If you want `A<C>` and `B` to be distinct but related types, `B` should extend `A<C>`. If you want them to be identical, you should use a `typedef`. Can you provide any more context?

Problem

I'm currently using something like that in my code: ``` class B : public A<C> { }; ``` Wouldn't it be better to use a typedef? ``` typedef A<C> B; ```

Original source