Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class Movie
- {
- public:
- Movie()
- {
- }
- Movie(const char* name)
- {
- this->name = (char*)name;
- }
- ~Movie()
- {
- std::cout << "Destructor called" << std::endl;
- delete[] name;
- }
- void SetName()
- {
- name = new char[100];
- std::cin >> name;
- }
- char* GetName() const
- {
- return name;
- }
- private:
- char* name;
- };
- int main()
- {
- Movie movie("Star Wars");
- std::cout << movie.GetName();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement