Assume that Disk and Tower are both classes. Furthermore assume the following header and constructor for class Triad:
Code:
class Triad
{
friend std::ostream& operator <<(std::ostream& lhs, Triad& rhs);
public:
Triad(int diskCount = 3);
~Triad();
void run();
void run(Tower* source, Tower* waypoint, Tower* dest, int toMove);
private:
Tower hanoi[3];
Disk* disks;
int diskNo;
void sort_disks(); // sorts disks from greatest to least
};
Triad::Triad(int diskCount)
:diskNo(diskCount)
{
disks = new Disk[diskNo];
sort_disks();
}
I have already included <iostream>, <string>, and <iomanip>, though I'm not so sure that's making any difference here.
What I want to ask is when that constructor is called with diskCount being 2 or higher, why in the world would disks not get more than one element?
Thank you in advance.