Hello
I am a new to C++ and have some questions.
I have two classes called Point and Square like this:
class Point {
int x, y;
public:
int getx() const {
return x;
}
int gety() const {
return y;
}
Point(int a, int b) {
x = a;
y = b;
}
};
class Square {
public:
int x, y, length, width;
SquareSpec(){return x, y, length, width;}
Square(Point, int, int);
};
Square::Square(Point A, int lngt, int wdth){
length = lngt;
width = wdth;
x = A.getx();
y = A.gety();
}
Now the thing is that somehow I need to put the Square specifications in to the linked list.
So in the main I get something like this:
int main() {
LinkedList<...> square1;
Point A(3,4);
Square sqrt(A, 6, 9);
square1.Insert(...);
}
My linked list insertion looks like this:
template <class T>
void LinkedList<T>::Insert(T d) {
}
What is the best way to get these specs in to the linked list?