class myClass {
int arr[100];
public:
void *get(long i, void* const to) const;
void *get(long i, bool nog);
void *tstfn(void* const to) { return get(0L,to); }
};
gcc -Wall nói:C++ Tại sao cuộc gọi không rõ ràng?
dt.cpp: In member function ‘void* myClass::tstfn(void*)’:
dt.cpp:6:49: warning: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: [enabled by default]
dt.cpp:4:9: note: candidate 1: void* myClass::get(long int, void*) const
dt.cpp:5:9: note: candidate 2: void* myClass::get(long int, bool)
Loại đối số nào bạn cung cấp làm tham số thứ hai? Tôi hỏi chủ yếu là tò mò; Tôi không thể giúp được gì nhiều. – Tommy
Cảm ơn tất cả! trả về ((const myClass * const) điều này) -> get (0L, to); đã hoạt động. –