Game Development Community

Problems with abstract data classes

by Marvin Hawkins · in Torque Game Engine · 01/16/2006 (4:18 pm) · 1 replies

HI this is a carry over from the general forum. I was told this was a better place to post.


Hello I'm not sure if this is the right place to post this but since I feel this is a general problem here goes.

I'm recieving an error from this line of code

class SetTeamEvent : public NetEvent

The error states that since it is an abstract class it cannot instatiate the object. I looked up the definition of Error C2259. It says that if a class doesn't use all the functions of an interface then it is considered abstract and cannot be used.

Here's the remedies suggested:



Make the access permissions public for the implemented methods.
*

Use the scope resolution operator for the interface methods implemented in the derived class to qualify the implemented method name with the name of the interface.

But since I'm new to programming I have no idea how to do that? Can anyone help?

#1
01/16/2006 (6:03 pm)
class NetEvent : public ConsoleObject
{
public:
   /// @}

   /// @name Things To Subclass
   /// @{

   [b]virtual void write(NetConnection *ps, BitStream *bstream) = 0;
   virtual void pack(NetConnection *ps, BitStream *bstream) = 0;
   virtual void unpack(NetConnection *ps, BitStream *bstream) = 0;
   virtual void process(NetConnection *ps) = 0;[/b]
};

You need to implement these functions in any class you derive from NetEvent that you want to instantiate (even if they are empty functions).