qfedu-cpp-level/day3/homework/h1.cpp

35 lines
452 B
C++
Raw Permalink Normal View History

2023-07-26 21:10:02 +08:00
#include <iostream>
#include <cstdlib>
#include <cstring>
using namespace std;
class SLink
{
private:
char *title;
public:
SLink() {}
SLink(const char *title)
{
this->title = (char *)malloc(50);
strcpy(this->title, title);
}
~SLink();
void show()
{
cout << title << endl;
}
};
SLink::~SLink() {}
int main()
{
SLink s1;
SLink s2("disen 补课中");
s2.show();
return 0;
}