0

i got some problems with inheritance from a templated class

template<size_t user_data_length>
class CParent
{
    struct Foo_Struct
    {
        int foo_1;
        array<uint8_t, user_data_length> data;
    };

};


template<size_t user_data_length>
class CChild
{
    using class_type = CParent<user_data_length>;

    class_type::Foo_Struct foo_obs_2 = {};

    CParent<user_data_length> foo_object = {};

    void Foo_Func1(CParent<user_data_length>::Foo_Struct& arg );

    void Foo_Func2(class_type::Foo_Struct& arg);


};

I can not figure out why a got the errors (all code is implemented in a header file so the compiler should know the template implementation).

First there seems to be a problem with

class_type::Foo_Struct foo_obs_2 = {};

The compiler tells me

need 'typename' before 'NTestcases::CChild<user_data_length>::class_type::Foo_Struct' because 'NTestcases::CChild<user_data_length>::class_type' is a dependent scope

Second problem are the function declarations for some reason the argument is not a valid type

could you give me some hints?

JuliusCaesar
  • 341
  • 3
  • 14

0 Answers0