Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Student {
- private:
- char * niza;
- public:
- Student() {
- }
- Student(char * _niza) {
- niza = new char[strlen(_niza)];
- strcpy(niza, _niza);
- }
- Student(const Student & tmp) {
- niza = new char[strlen(tmp.niza)];
- strcpy(niza, tmp.niza);
- }
- ~Student() {
- delete[] niza;
- }
- void set_niza(char * _niza) {
- niza = new char[strlen(_niza)];
- strcpy(niza, _niza);
- }
- char * get_niza() {
- return niza;
- }
- };
- int main()
- {
- Student s("abcdef");
- cout << s.get_niza() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement