constructor
coding a constructor for a simple class
Start file
class SongEntry { public: SongEntry ( QString mSinger = QString(), QString mSongName = QString(), QString mGender = QString(), QString mSongLang = QString(), int mSongLength = 0, QString mSongPath = QString(), QString mNotes = QString() ); private: int mId; QString mSinger; QString mSongName; QString mGender; QString mSongLang; int mSongLength; // in seconds QString mSongPath; QString mNotes; }; ===========================================================
End file
class SongEntry { public: SongEntry ( QString mSinger = QString(), QString mSongName = QString(), QString mGender = QString(), QString mSongLang = QString(), int mSongLength = 0, QString mSongPath = QString(), QString mNotes = QString() ); private: int mId; QString mSinger; QString mSongName; QString mGender; QString mSongLang; int mSongLength; // in seconds QString mSongPath; QString mNotes; }; =========================================================== SongEntry::SongEntry ( QString aSinger, QString aSongName, QString aGender, QString aSongLang, int aSongLength, QString aSongPath, QString aNotes ) : mSinger( aSinger ) , mSongName( aSongName ) , mGender( aGender ) , mSongLang( aSongLang ) , mSongLength( aSongLength ) , mSongPath( aSongPath ) , mNotes( aNotes ) { }
View Diff
26a27,46 > > SongEntry::SongEntry > ( > QString aSinger, > QString aSongName, > QString aGender, > QString aSongLang, > int aSongLength, > QString aSongPath, > QString aNotes > ) > : mSinger( aSinger ) > , mSongName( aSongName ) > , mGender( aGender ) > , mSongLang( aSongLang ) > , mSongLength( aSongLength ) > , mSongPath( aSongPath ) > , mNotes( aNotes ) > { > }
Solutions by @codebeige:
Unlock 4 remaining solutions by signing in and submitting your own entry