Ho bisogno di implementare una classe di numeri che supporta l'operatore < < per l'output. ho un errore: "identificatore "ostream" non è definito" da qualche ragione eventhough ho incluso e prova anche"ostream" errore non definito
qui il file di intestazione:
Number.h
#ifndef NUMBER_H
#define NUMBER_H
#include <iostream>
class Number{
public:
//an output method (for all type inheritance from number):
virtual void show()=0;
//an output operator:
friend ostream& operator << (ostream &os, const Number &f);
};
#endif
perché l'isnt compilatore riconoscere ostream nella funzione amico?
Perché, come per tutti i tipi e le funzioni di libreria standard, solo * non è * "ostream". C'è solo 'std :: ostream'. –