invalid use of incomplete type

后端 未结 5 1657
北海茫月
北海茫月 2020-11-30 01:43

I\'m trying to use a typedef from a subclass in my project, I\'ve isolated my problem in the example below.

Does anyone know where I\'m going wrong?

         


        
5条回答
  •  情书的邮戳
    2020-11-30 02:03

    You need to use a pointer or a reference as the proper type is not known at this time the compiler can not instantiate it.

    Instead try:

    void action(const typename Subclass::mytype &var) {
                (static_cast(this))->do_action();
        }
    

提交回复
热议问题