Sollte man das mit einem Null-Zeichen terminieren? Eine schöne Klasse für ganz unnötige Sachen wäre natürlich auch möglich: Code: #ifndef __MXAPI__ #define __MXAPI__ class MXAPI { public: //int calculateSenseOfLive() // TODO: comment char *calculateSenseOfLive() // TODO: comment }; #endif Code: #include "mxapi.h" /* int MXAPI::calculateSenseOfLive() { // Not sure if this is correct, but it should work most of the time. return 42; } */ char *MXAPI::calculateSenseOfLive() { // Not sure if this is correct, but it should work most of the time. return "42"; }
#ifndef __MXAPI__ #define __MXAPI__ class MXAPI { public: //int calculateSenseOfLive() // TODO: comment char *calculateSenseOfLive() // TODO: comment }; #endif
#include "mxapi.h" /* int MXAPI::calculateSenseOfLive() { // Not sure if this is correct, but it should work most of the time. return 42; } */ char *MXAPI::calculateSenseOfLive() { // Not sure if this is correct, but it should work most of the time. return "42"; }
Geändert von Drakes (05.04.2008 um 13:03 Uhr)
Foren-Regeln