What are the rules for virtual function lookup?

前端 未结 3 1899
忘掉有多难
忘掉有多难 2021-01-19 02:37
#include 
class base
{
    public:
    virtual void print (int a)
    {   
        std::cout << \"a: \" << a << \" base\\n\";
    }         


        
3条回答
  •  梦谈多话
    2021-01-19 02:53

    Because double can be automatically converted to an int in the first definition it sees (in the base class)

    See explicit keyword or this question

提交回复
热议问题