gpt4 book ai didi

c++ - 为什么我继承了这个函数却得不到匹配的函数

转载 作者:可可西里 更新时间:2023-11-01 17:35:57 26 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
overloaded functions are hidden in derived class

我有 A 类和 B 类(A 的子类)

A类有功能

virtual void foo(int, int);
virtual void foo(int, int, int);

当我尝试做的时候

B类有功能

virtual void foo(int, int);

当我尝试用类调用 foo(int, int, int) 时,编译器不允许我这样做,因为它说

no matching function for foo(int,int,int)
candidate is foo(int,int);

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com