Static polymorphism in C++

后端 未结 2 2151
忘掉有多难
忘掉有多难 2021-02-20 08:01
#include 

template
struct renderer{
    void get(){
        static_cast(this)->get();
    }
};
struct open_gl : pub         


        
2条回答
  •  日久生厌
    2021-02-20 08:46

    1. Becuase get is not marked const.
    2. Because the base class method is used (irrelevantly of cast), and it goes into infinite loop.

提交回复
热议问题