Hello,
i code with qt in console mode but i have an error in the method that should display the members of a simple class.
the error is " erreur : cannot bind 'std::basic_ostream<char>' lvalue to 'std::basic_ostream<char>&&' cout << " type " << type; "
here the .cpp
Qt Code:
  1. #include "vehicule.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. Vehicule::Vehicule()
  6. {
  7. nbrPortes = 4;
  8. type = "Voiture";
  9. puissance = 5;
  10. }
  11. Vehicule::Vehicule(int portes, QString typeV, int puissanceV)
  12. :nbrPortes(portes), type(typeV), puissance(puissanceV)
  13. {}
  14. Vehicule Vehicule::operator+(Vehicule const &vehicule)
  15. {
  16. puissance = vehicule.puissance;
  17. type = type + " vehicle améilloré ";
  18. }
  19. void Vehicule::afficher() const
  20. {
  21. cout << "Voiture avec " << nbrPortes;
  22. cout << " type " << type;
  23. cout << " et avec une puissane de "
  24. << puissance << endl;
  25. }
To copy to clipboard, switch view to plain text mode 
.h
Qt Code:
  1. #ifndef VEHICULE_H
  2. #define VEHICULE_H
  3. #include <QString>
  4.  
  5.  
  6. class Vehicule
  7. {
  8. public:
  9. Vehicule();
  10. Vehicule(int portes, QString typeV, int puissanceV);
  11. Vehicule operator+(Vehicule const &vehicule);
  12. void afficher() const;
  13.  
  14. protected:
  15. int nbrPortes;
  16. QString type;
  17. int puissance;
  18. };
  19.  
  20. #endif // VEHICULE_H
To copy to clipboard, switch view to plain text mode 
if some one can help me please. thank you.