Skip to content

Instantly share code, notes, and snippets.

@gallirohik
Created August 1, 2018 08:32
Show Gist options
  • Save gallirohik/d21883e8a054d6a6a8288a97a2e01212 to your computer and use it in GitHub Desktop.
Save gallirohik/d21883e8a054d6a6a8288a97a2e01212 to your computer and use it in GitHub Desktop.
My Brand new MyplayList project
#include<iostream>
using namespace std;
class Song
{
private:string name;
string composer;
string gener;
float duration;
int id;
public:Song(string name,string composer,string gener,float duration);
void getDetails();
string getName();
string getComposer();
string getGener();
float getDuration();
string getId();
};
Song::Song(string name,string composer,string gener,float duration)
{
this->name=name;
this->composer=composer;
this->gener=gener;
this->duration=duration;
}
void Song::getDetails()
{
cout<<this->name<<endl;
cout<<this->composer<<endl;
cout<<this->gener<<endl;
cout<<this->duration<<endl;
}
string Song::getName()
{
return this->name;
}
string Song::getComposer()
{
return this->composer;
}
string Song::getGener()
{
return this->gener;
}
float Song::getDuration()
{
return this->duration;
}
int main()
{
Song s("kwaja","AR","dev",5.25);
s.getDetails();
cout<<s.getName()<<endl;
cout<<s.getComposer()<<endl;
cout<<s.getGener()<<endl;
cout<<s.getDuration();
return 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment