Mit printf gehts, mit cout aber nicht?
-
Hallo,
in meinem C++ Programm arbeitet folgende Anweisung mit printf bestens, aber mit cout gibts einen ERROR beim compilieren:printf("Rechts: %d\n", *knoten->rechts); // *knoten is ein Pointer auf ein Objekt
cout<<"Rechts: " <<*knoten->rechts; // Klappt nicht
Folgende Meldung erscheint:
error C2679: binary '<<' : no operator defined which takes a right-hand operand of type 'class Student' (or there is no acceptable conversion)Da ich noch C++ Noob bin hab ich keine Ahnung warum,weshalb,wieso.
Grüße Mambule.
-
Ich bezweifle, dass das prinft wirklich funktioniert. Wenn *knoten->rechts vom Typ Student ist, dürftest du es nicht mit %d ausgeben.
-
(*knoten)->rechts
-
( student) *knoten->rechts;