Using structs of derived class y base template

拥有回忆 提交于 2019-12-24 07:46:10

问题


I have a base template:

template <typename T>
class Base
{
    public:
        void method(T);
};

And a derived class:

class Derived: public Base<Derived::status_t>
{
    public:
     typedef struct
     {
        uint8_t value;
     } status_t; 
} 

I'm have more derived classes, each one with it status_t specific struct. I want to use these structs in the base class, but the compiler give me an error:

Error[Pe070]: incomplete type is not allowed.

I suppose that the problem is that the struct is not defined in the moment that the base constructor is called. Is there any way to maintain the struct in the derived class and use it un the base template?

Thanks,

来源:https://stackoverflow.com/questions/53722206/using-structs-of-derived-class-y-base-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!