Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class music {
- public:
- void print() {
- cout << "жанр :" << Type << " Год: " << Year << endl;
- }
- music(string Type) {
- typee = Type;
- }
- string typee;
- /*
- void m_print() {
- Type = Type + Year;
- cout << "строка + строка = " << Type;
- cout << endl;
- Type = Year;
- cout << "первая строка = второй строке : " << Type;
- cout << endl;
- //cout << " первая строка = второй строке : " << lol_1 << endl;
- }*/
- void enter(string type) {
- Type = type;
- }
- void enter(string type, string year) {
- Type = type;
- Year = year;
- }
- string ret_type() {
- return Type;
- }
- void disp() {
- cout << typee << endl;
- }
- music();
- music(string);
- music(string, string);
- ~music();
- private:
- string Type;
- string Year;
- };
- music::~music() {
- }
- music::music() {
- cout << "it works!" << endl;
- }
- music::music(string type) {
- Type = type;
- type = "неизвестен";
- cout << "жанр : " << type << endl;
- }
- music::music(string type, string year) {
- Type = type;
- type = "неизвестен";
- Year = year;
- year = "9999";
- cout << "жанр : " << type <<" Год: "<<year<< endl;
- }
- music operator+(music c1, music c2) {
- return music(c1.typee +c2.typee);
- }
- class music_music : music {
- public:
- music_music();
- ~music_music();
- private:
- };
- music_music::~music_music() {
- }
- music_music::music_music() {
- }
- int main() {
- setlocale(LC_ALL, "Russian");
- music_music mm;
- //mm;
- music music1;
- music1.enter("funny", "1000");
- music1.print();
- //music1.m_print();
- music music2;
- music2.enter("horror", "2000");
- music2.print();
- music c1 ("abv");
- music c2 ("gde");
- music c3 = c1+c2;
- c3.disp();
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement