繁体   English   中英

尝试打印字符串返回时为什么会出现编译器错误?

[英]Why am I getting a compiler error when I'm trying to print string return?

我认为这是一个重载运算符错误,但我不明白为什么它会假设我正在尝试使用重载运算符。

string Customer::getCustomerName() 
{
    return customerName;
}

string Customer::getCustomerLicense()
{
    return customerLicense;
}

Date* Customer::getCustomerBirthday()
{
    return customerBirthday;
}

void Customer::printCustomerObject()
{
    cout << getCustomerName(); // No operator "<<" matches these operands
}                                 ERROR CODE: E0349

我认为您没有包括标准的字符串标题。
#include <string>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM