May 9, 2011 at 2:20pm UTC
Hi all,
How do I access the base class function when I'm calling the derived class.
The part I'm struggling is in bold.
Thanks
class MusicalComposition{
public:
MusicalComposition();
MusicalComposition(string titleP,string composerP,char year_writtenP);
};
class NationalAnthem : public MusicalComposition{
private:
string nation;
public:
NationalAnthem();
};
NationalAnthem::MusicalComposition(){
cout << "Hello World";
};
May 10, 2011 at 8:08am UTC
Hi thanks for the reply but I still seem like i can't tackle this problem.
One of the questions ask in assignment is
"Implement the overload constructor for class NationalAnthem by invoking the base class contructor"
When they ask the question like this do they mean i must phrase it like this?
NationalAnthem::NationalAnthem(string name) : MusicalComposition()
{
//Additional code goes here.
}