|
-
August 24th, 2009, 11:29 AM
#1
What does # and \ represent in C++ ?
I came across a piece of code which is a RTTI class. (run time type information). The class is called "RTTI".
There are a few defines below the class declaration and one of them is this:
#define RTTI_IMPL(name,parent) \
const RTTI name::rtti(#name,parent::rtti);
rtti is defined as "static const RTTI rtti;"
An example of how the #define is used is this:
RTTI_IMPL(BillBoard,GameObject); where BillBoard is the child class and GameObject is the parent class of Billboard.
What does '\' mean in the #define statement and also, what does # in "#name" represent?
On another note, I came across a method declaration like this:
virtual void RegisterEvents(class EventHandlerComponent *pkEventHandler);
EventHandlerComponent is a class which is declared and defined in another .h and cpp file. What does adding the keyword "class" in the method's parameter do? Is there a difference if I use this instead?
virtual void RegisterEvents(EventHandlerComponent *pkEventHandler);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|