我已經提供了下面的代碼。當我重載一個重載的postfix操作符時,編譯器會拋出錯誤。它可以在重載的前綴運算符上正常工作。錯誤 error: no match for ‘operator<<’ in ‘std::cout << cDigit.Digit::operator++(0)’
代碼 #include <iostream>
using namespace std;
class Di
基本上,我有重載< <運營商爲我tokenType結構,它遵循的(不能改變,我必須使用這種方式) struct tokenType
{
int category ; // one of token categories defined above
union
{
int operand ;
char symbol ; // '+' , '-'
我的計算機科學教授希望我們找到cout的聲明。我使用g ++和-E參數編譯了一個簡單的Hello World程序。這裏是我的HELLO.CPP是什麼樣子: #include <iostream>
using namespace std;
int main(){
string name="";
cout << "Good morning! What's your na