468,456 Members | 1,639 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,456 developers. It's quick & easy.

problems with the constructor

1
Hi!

First of all, perdon for my English. I don't express the thinks very good.

Well, I'm working with eclipse 3.1.1, wxWidgets 2.4.2, MSYS 1.0.10 and Mingw 3.1.0. I'm doing a project in c++. I've got problems with one library, the compiler don't accept the multiply definition of the constructor. The compiler give me errors in the lines of the constructor definition. But it don't anything about what happends withs this lines.

Anybody can help me?? I don't know if I have to compile the project with a specific parameter.

The code is this:

//-*-c++-*-
#ifndef INCLUDED_BehaviorBase_h_
#define INCLUDED_BehaviorBase_h_

#include "Events/EventListener.h"
#include "Shared/ReferenceCounter.h"
#include <string>
#include <set>

class BehaviorBase : public ReferenceCounter, public EventListener {
public:
//! destructor - if is active when deleted, will display a warning (don't delete directly - use RemoveReference())
virtual ~BehaviorBase();

virtual void DoStart();
virtual void DoStop();

virtual void processEvent(const EventBase& /*event*/) {}

//! Identifies the behavior in menus and such
virtual std::string getName() const { return instanceName; }

//! Allows dynamic renaming of behaviors
virtual void setName(const std::string& name) { instanceName=name; }

virtual std::string getDescription() const {
std::string d=getClassDescription();
return (d.size()==0)?getName():d;
}

virtual std::string getClassName() const { return className; }

static std::string getClassDescription() { return ""; }

//! Returns true if the behavior is currently running
virtual bool isActive() const { return started; }

static const std::set<BehaviorBase*>& getRegistry() { return registry; }


protected:
//! constructor, @a name is used as both instance name and class name
explicit BehaviorBase(const std::string& name);
//! constructor, allows different initial values for class name and instance name
BehaviorBase(const std::string& classname, const std::string&
instancename);
//! copy constructor; assumes subclass handles copying approriately - i.e. if @a b is active, the copy will be as well, even though DoStart was never called..
BehaviorBase(const BehaviorBase& b);
//! assignment operator; assumes subclass handles assignment appropriately - i.e. if @a b is active, the copy will be as well, even though DoStart was never called..
BehaviorBase& operator=(const BehaviorBase& b);

bool started; //!< true when the behavior is active
std::string instanceName; //!< holds the name of this instance of behavior
const std::string className; //!< holds the type of the subclass of this behavior as a string
static std::set<BehaviorBase*> registry; //!< allows us to keep track of all the current behaviors
};

#endif
Jul 9 '06 #1
0 1326

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by -Steve- | last post: by
7 posts views Thread by sureshsundar007 | last post: by
18 posts views Thread by __PPS__ | last post: by
3 posts views Thread by Wilson | last post: by
3 posts views Thread by Peter Oliphant | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.