question on namespace declaration from stroustrup section 8.2.8.1

I have a question on namespace declaration from stroustrup section 8.2.8.1

<stroustrup>

--Section 8.2.8--
1
2
3
4
5
6
7
His_string {
    class String { /*...*/ };
    String operator+(const String&, const String&);
    String operator+(const String&, const char *);
    void fill(char);
    //...
}


--Section 8.2.8.1--
Occasionaly, we want access to only a few names from a namespace. We would do
do that by writing a namespace declaration containing only those names we want.
For example, we could declare a version of His_string that provided the String
itself and the concatenation operator only:

1
2
3
4
5
namespace His_string {
    class String { /*...*/ };
    String operator+(const String&, const String&);
    String operator+(const String&, const char *);
};


</stroustrup>

My question - His_string has a *definition* of a class. Wont writing a
duplicate His_string namespace declaration in your file, also containing the class definition, give me a *redefinition* compile time error? (*compiled it and yes it gives an error*)
Last edited on
You answered your own question. Yes.
Then the example he has given is wrong?!
Topic archived. No new replies allowed.