Undefined Reference in Polymorphism

I keep getting and undefined reference error when I implement my prototypes. I have the following classes Shape, Box, and Van as follows:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Shape
{
public:
  Shape();
  Shape(float x, float y, float z, bool v);
  virtual ~Shape();
  virtual const char* Name() const;
  virtual float Volume() const;
  virtual float Area() const;

protected:
  float x_, y_, z_;
  bool verbose_ = 0;

private:
  Shape (const Shape&);
  Shape& operator= (const Shape&);
};

class Box : public Shape
{
public:
  Box();
  Box(float width, float length, float height, bool v);
  virtual ~Box();
  const char* Name () const;
  float Volume() const;
  float Area() const;
};

class Van : public Truck, public Box
{
public:
  Van();
  Van(const char*, unsigned int, char*, float w, float l, float h, bool v);
  virtual ~Van();
  float LoadCapacity() const; // returns volume of box
  const char* ShortName() const; // returns "VAN"

private:
  Van(const Truck&);
  Van& operator=(const Van&);
};


My implementation for Van is:
1
2
3
4
Van::Van(const char* serialNumber, unsigned int passengerCapacity, char *DOTLicense, float w, float l, f\
loat h, bool v) : Truck(serialNumber, passengerCapacity, DOTLicense), Box(w, l, h, v)

{}
Last edited on
¿undefined reference to what?
http://www.cplusplus.com/forum/general/113904/

of all your function you only show the implementation of one constructor
also, you talk about a `Truck' class, but don't provide its implementation
main() is missing too

prefer composition instead of inheritance (a Van contains a Box)
Topic archived. No new replies allowed.