C++ class pointer without giving template parameters

后端 未结 3 1421
生来不讨喜
生来不讨喜 2021-01-19 17:40

Hello dear people of the underworld called the internet.

Lets say we have a class called X with the template parameters(Y):

template
c         


        
3条回答
  •  心在旅途
    2021-01-19 18:03

    Not with X*. Consider this alternative:

    class BaseX { 
        //...
    };
    
    template
    class X : public BaseX
    {
        //...
    };
    

    Since BaseX is a complete type, you can have BaseX* that references some X once you've defined it.

提交回复
热议问题