小编Sav*_*vvy的帖子

模糊错误:模板C++

我已经尝试了几乎所有可以想象的东西(当然除了正确的东西),但仍然无法理解为什么我会得到一个模棱两可的错误.我相当肯定这是一件非常愚蠢的事情但我却看不到它!我的编译器显示插入操作符的警告,我知道他们都被调用了但是我被告知坚持旧的virtual会帮助我(并且它没有...),但是还没有!

#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

template <class T>
T produceReport(string title, T accType, int tableRows)
{
    cout << title << endl;
    for (int x = 0; x < tableRows; x++)
    {
        cout << "-";
    }
    cout << endl << accType;
};

class BankAccount
{
private:
    int accNum;
    double accBal;
public:
    BankAccount(int = 0, double = 0.0);
    void enterAccountData();
    void displayAccount();
}; 

BankAccount::BankAccount(int num, double bal)
{
    accNum = num;
    accBal = bal;
} 

void …
Run Code Online (Sandbox Code Playgroud)

c++ ambiguous function-templates

1
推荐指数
1
解决办法
875
查看次数

标签 统计

ambiguous ×1

c++ ×1

function-templates ×1