class <name>;

C

Christopher

I came across this line in a lib I am studing, it simply has
class cSceneNode;
all by itself. what is that line doing? I am used to seeing a
declaration: MyClass test;
or definition: class MyClass{ public: foo();};
but never just: class <name>;

Thanx,
Christopher
 
?

=?ISO-8859-1?Q?Le_G=E9ant_Vert?=

Christopher said:
I came across this line in a lib I am studing, it simply has
class cSceneNode;
all by itself. what is that line doing? I am used to seeing a
declaration: MyClass test;
or definition: class MyClass{ public: foo();};
but never just: class <name>;

Thanx,
Christopher
this is a forward declaration ; this is used for example when A uses a B
and B uses an A ...
this just means that the implementation of this class is somewhere else,
but you can use it.
 
R

Rolf Magnus

Christopher said:
I came across this line in a lib I am studing, it simply has
class cSceneNode;
all by itself. what is that line doing?

It (forward-)declares a class.
I am used to seeing a
declaration: MyClass test;

That's a definition. It defines an object of class MyClass.
or definition: class MyClass{ public: foo();};

That defines a class.
but never just: class <name>;

That declares a class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,159
Messages
2,570,886
Members
47,419
Latest member
ArturoBres

Latest Threads

Top