Casting pointer to derived class to reference to pointer to base class

前端 未结 4 1727
星月不相逢
星月不相逢 2021-01-17 02:47

Why I can\'t cast a pointer to derived class to reference to pointer to base class?

struct Base { };
struct Derived : Base { };

int main()
{
    Derived* de         


        
4条回答
  •  被撕碎了的回忆
    2021-01-17 03:11

    For your Error only change this

    static_cast(derived);
    to 
    static_cast(derived);
                    ^^
    

    See here http://ideone.com/1QuMLK

提交回复
热议问题