#include #include
using std::cout; using std::endl;
class Printer { private: char *s1; public: char *SetString(s1); void Showstring(); }; char Printer::*SetString(s1){ return s1; } void Printer::Showstring(){ cout<<SetString(s1); } int main(void){ Printer pnt; pnt.SetString("Hello"); pnt.Showstring(); }
'pnt.SetString("Hello");' save "Hello" to 'private: char *s1;' 'pnt.Showstring();' bring 'private: char *s1;' and print s1
Aucun commentaire:
Enregistrer un commentaire