Hi
This is my first DaniWeb post so I hope I get it right.
My problem is homework. I have almost got it but I'm having trouble with the pointers. The entire program will output svg code but I've tried to leave out as much as I can to reduce the amount of code. There are a number of shape classes, two have been left as stubs. One Svg class and a DataType class. The DataType class has an enumeration of shapes and a union of pointers. This is where I am getting confused. I can't change the way the driver works because code was supplied with the assignment to run the program. I know there is something wrong with the Append functions but I can't work out how to fix them. When I compile, I get the appended rectangles appearing properly above the svg header, then the header, then "89892" which I presume is an address, then the rectangle addresses, then an error "*** glibc detected *** free(): invalid pointer: 0xb7feaff4" then the closing svg tag and the word Aborted.
The output should be: the svg header, then the rectangle tags, then the svg end tag.
Thanks in advance
#include <iomanip> // output formatting
#include <vector> // vector class
#include <iostream>
#include <fstream>
#include <string>
#include <cassert>
using namespace std;
class Path
{
public:
//stub
}; // Path
class Circle
{
public:
//stub
}; // Circle
class Rectangle
{
public:
Rectangle();
Rectangle(int x, int …