#include <iostream>
#include <cstring>
using namespace std;
class A {
public: char *str;
A(char *s) : str(s) { }
operator char*() {return str;}
};
int main() {
char input[20];
cin >> input;
A a(input);
// A ==> char *
char *s = static_cast<char*>(a);
strcat(s, "-success");
cout << s;
return 0;
}
Thanks
Happy Programming !
#include <cstring>
using namespace std;
class A {
public: char *str;
A(char *s) : str(s) { }
operator char*() {return str;}
};
int main() {
char input[20];
cin >> input;
A a(input);
// A ==> char *
char *s = static_cast<char*>(a);
strcat(s, "-success");
cout << s;
return 0;
}
Thanks
Happy Programming !
No comments:
Post a Comment