Is this forward declaration legal C++?

J

Joost Kraaijeveld

Hi all,

Is this legal (including the namespace in the forward declarion):

namespace NS
{
class NS:ForwardDeclaratedClass;
};

Other file:
namespace NS
{
class ForwardDeclaratedClass
{
};
};

--
Joost Kraaijeveld
Askesis B.V.
Molukkenstraat 14
6524NB Nijmegen
tel: 024-3888063 / 06-51855277
fax: 024-3608416
e-mail: (e-mail address removed)
web: www.askesis.nl
 
R

Rob Williscroft

Joost Kraaijeveld wrote in in comp.lang.c++:
Hi all,

Is this legal (including the namespace in the forward declarion):

namespace NS
{
class NS:ForwardDeclaratedClass;

class ForwardDeclaratedClass;
};

Other file:
namespace NS
{
class ForwardDeclaratedClass
{
};
};

Spurious 'NS:' aside yes.

Rob.
 
R

Rob Williscroft

Sharad Kala wrote in in comp.lang.c++:
Couple of things wrong with your code.

No semicolon here

Its a namespace not a class the semicolon isn't required.

Rob.
 
S

Sharad Kala

Rob Williscroft said:
Sharad Kala wrote in in comp.lang.c++:


Its a namespace not a class the semicolon isn't required.

And that's what I wrote (to drop the unnecessary semicolons), am I missing
your point?
 
R

Rob Williscroft

Sharad Kala wrote in in comp.lang.c++:
And that's what I wrote (to drop the unnecessary semicolons), am I
missing your point?

NO :). sorry for the noise.

Rob.
 
H

Howard

Rob Williscroft said:
Sharad Kala wrote in in comp.lang.c++:


NO :). sorry for the noise.

Sharad, In case you're wondering why that mistake was made, you used the
phrase "No semicolon here". That's an incomplete sentence in English, and
it can be interpreted in two different ways. Either: "There is no semicolon
here, but there should be, so you should add it.", or "No semicolon is
required or desired here, so you should remove it." He apparently thought
you meant the first, but you actually meant the second.

-Howard
 
S

Sharad Kala

Howard said:
Sharad, In case you're wondering why that mistake was made, you used the
phrase "No semicolon here". That's an incomplete sentence in English, and
it can be interpreted in two different ways. Either: "There is no semicolon
here, but there should be, so you should add it.", or "No semicolon is
required or desired here, so you should remove it." He apparently thought
you meant the first, but you actually meant the second.

Howard,
I know that the sentence was incomplete. But I think that the context in
which I was talking was pretty clear. Interpreting it as "There is no
semicolon here, but there should be, so you should add it." would mean that
I have some problem in my eye sight which isn't the case actually. No
offense meant.
 

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

No members online now.

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top