Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class Cinema
- {
- protected:
- char title[64];
- public:
- Cinema();
- Cinema(char *titleM);
- void set_title(char *titleM);
- };
- Cinema::Cinema()
- {
- strcpy_s(title, "0");
- }
- Cinema::Cinema(char *titleM)
- {
- set_title(titleM);
- }
- void Cinema::set_title(char *titleM)
- {
- strcpy_s(title, titleM);
- }
- //////////////////////////////////////////////////////
- class Remake : public Cinema
- {
- private:
- int year;
- float rating;
- public:
- Remake();
- Remake(int yearM, float ratingM);
- void set(int yearM, float ratingM);
- void show();
- };
- Remake::Remake()
- {
- year = 0;
- rating = 0;
- }
- Remake::Remake(int yearM, float ratingM)
- {
- set(yearM, ratingM);
- }
- void Remake::set(int yearM, float ratingM)
- {
- year = yearM;
- rating = ratingM;
- }
- void Remake::show()
- {
- cout << "Remake title: " << title << endl;
- cout << "Year: " << year << endl;
- cout << "Rating: " << rating << endl;
- }
- //////////////////////////////////////////////////////
- int main()
- {
- char title[64];
- int year;
- float rating;
- cout << "Movie Title: "; cin >> title;
- cout << "Year of movie remake: "; cin >> year;
- cout << "Rating of movie remake: "; cin >> rating;
- cout << endl;
- Remake obj;
- obj.set_title(title);
- obj.set(year, rating);
- obj.show();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement