S
supachamp
Hi everybody,
I am having great problems with the following classes. I just can't
figure out why I keep getting the error message:
Building file: ../edge.cc
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -oedge.o ../edge.cc
.../edge.cc: In constructor `Edge::Edge(Vertex&, Vertex&)':
.../edge.cc:4: error: uninitialized reference member `Edge::v0'
.../edge.cc:4: error: uninitialized reference member `Edge::v1'
Here are the classes: (header file)
class Vertex : public Object
{
public:
typedef unsigned int Number;
protected:
Number number;
public:
Vertex() {};
Vertex (Number _number) : number(_number) {};
Number getNumber() {return number;};
};
class Edge {
protected:
Vertex& v0;
Vertex& v1;
public:
Edge(Vertex&, Vertex&);
virtual Vertex& V0 () const;
virtual Vertex& V1 () const;
virtual Vertex& Mate (Vertex const&) const;
};
/* possible types of a transition/ arc */
enum transitionType {sending, receiving};
class IGEdge : public Edge {
protected:
char * label; /* label of the arc (usually the name of the event)
*/
transitionType type; /* type of the arc (sending, receiving) */
public:
IGEdge (Vertex&, Vertex&, char *, transitionType);
virtual ~IGEdge () {delete label;};
char * getLabel() {return label;};
transitionType getType() {return type;};
Vertex& V0 () {return v0;};
Vertex& V1 () {return v1;};
Vertex& Mate (Vertex const&) {return v0;}; // TODO!
};
implementation:
#include "edge.h"
#include "vertex.h"
Edge::Edge(Vertex& _v0, Vertex& _v1) {
v0 = _v0;
v1 = _v1;
}
IGEdge::IGEdge(Vertex& _v0, Vertex& _v1, char * _label, transitionType
_type) : Edge(_v0, _v1) {
type = _type;
label = _label;
}
Is there anyone out there who can help me fix this problem?
Thanks a lot in advance!
CQ.
I am having great problems with the following classes. I just can't
figure out why I keep getting the error message:
Building file: ../edge.cc
Invoking: GCC C++ Compiler
g++ -O0 -g3 -Wall -c -fmessage-length=0 -oedge.o ../edge.cc
.../edge.cc: In constructor `Edge::Edge(Vertex&, Vertex&)':
.../edge.cc:4: error: uninitialized reference member `Edge::v0'
.../edge.cc:4: error: uninitialized reference member `Edge::v1'
Here are the classes: (header file)
class Vertex : public Object
{
public:
typedef unsigned int Number;
protected:
Number number;
public:
Vertex() {};
Vertex (Number _number) : number(_number) {};
Number getNumber() {return number;};
};
class Edge {
protected:
Vertex& v0;
Vertex& v1;
public:
Edge(Vertex&, Vertex&);
virtual Vertex& V0 () const;
virtual Vertex& V1 () const;
virtual Vertex& Mate (Vertex const&) const;
};
/* possible types of a transition/ arc */
enum transitionType {sending, receiving};
class IGEdge : public Edge {
protected:
char * label; /* label of the arc (usually the name of the event)
*/
transitionType type; /* type of the arc (sending, receiving) */
public:
IGEdge (Vertex&, Vertex&, char *, transitionType);
virtual ~IGEdge () {delete label;};
char * getLabel() {return label;};
transitionType getType() {return type;};
Vertex& V0 () {return v0;};
Vertex& V1 () {return v1;};
Vertex& Mate (Vertex const&) {return v0;}; // TODO!
};
implementation:
#include "edge.h"
#include "vertex.h"
Edge::Edge(Vertex& _v0, Vertex& _v1) {
v0 = _v0;
v1 = _v1;
}
IGEdge::IGEdge(Vertex& _v0, Vertex& _v1, char * _label, transitionType
_type) : Edge(_v0, _v1) {
type = _type;
label = _label;
}
Is there anyone out there who can help me fix this problem?
Thanks a lot in advance!
CQ.