To understand what going on, we need to break the first statement up into it's parts:
struct _actor
{
...
};
typedef struct _actor _actor;
typedef struct _actor Actor;
First we create a structure called _actor
. Next, we create a typedef for struct _actor
called _actor
. This is only useful in C. It allows us to say:
_actor myActor;
instead of
struct _actor myActor;
But in C++, it's unnecessary, as C++ allows us to use the first form natively, without the typedef.
The third line creates a second typedef for struct _actor
called Actor
.
When you then try to create a class named Actor
the compiler complains, as that name is already being used for the alias for the struct.
Now, it seems likely that in the original C code, the author had intended struct _actor
to be merely an implementation detail, and that you would always use just Actor
to refer to instances of this struct. Therefore, in your C++ code, you should probably eliminate the typedefs entirely, and just rename the struct. However, that will give you:
struct Actor {.....}
class Actor {.....}
So, prehaps you should look into merging those two classes.