Константин Степанов class Audioformat {
public:
//Audioformat(){mp3_counter++;};
virtual string titel() { return ""; }
virtual string info() { return ""; }
virtual ~Audioformat() {};
};
int mp3_counter = 0;
class MP3_Format : public Audioformat {
public:
MP3_Format(){mp3_counter++;};
MP3_Format(MP3_Format &cop){
MP3_Format(cop.song);
mp3_counter++;
}
MP3_Format(const char* c_string) {
song = (const char*) c_string;
mp3_counter++;
}
MP3_Format(string _song): song(_song){
mp3_counter++;
}
MP3_Format& operator=(const MP3_Format&){
cout<< "Im here" ;
return *this ;
}
~MP3_Format(){mp3_counter--;}
string titel() { return song; }
string info() { return "MP3"; }
operator string() const { return song; }
operator string() { return song; }
friend bool operator==(const MP3_Format& lhs, const MP3_Format& rhs)
{
return lhs.song == rhs.song;
}
friend bool operator!=(const MP3_Format& lhs, const MP3_Format& rhs)
{
return !operator==(lhs,rhs);
}
MP3_Format& operator=(const char* c_string){
song = *c_string;
return *this;
}
private:
string song;
};
Тест я не могу изменять
bool test_A1_e() {
#ifdef A1_e
//MP3_Format mp3a("Summertime");
MP3_Format mp3a = "Summertime";
MP3_Format mp3b;
mp3b = "Summertime";
cout << mp3b.titel() << " mp3b.titel()";
string ta = mp3a.titel();
string tb = mp3b.titel();
return (ta == "Summertime" &&
tb == "Summertime" );
#else
return false;
#endif
}