2 msgNeed some help on the options of g++
4 msgAdding marker (.dot) instructions at procedure ...
2 msggcc_assert()
4 msginsn_condition table
1 msggfortran case sensitive
2 msgIssue group
3 msgC++ error: cannot convert 'unsigned int A::*' t...
2 msgFwd: How to deliver my source code???
3 msgcast_stream not declared error
3 msgSyntax Problem
3 msggcc 1.95.3 on solaris 9
2 msgIncluding static libraries
2 msgSeveral GCC Versions
1 msgProblem with gcc-4.0.0
19 msgValgrind - exact leak location.
2 msgcannot link an .o file
3 msgSelect instruction support in GCC
1 msgRe: Problems shifting an int 32 times. Gcc 3.4.5
2 msgg++ compile problem using inttypes.h

namespaces composition and selection
\ Anitha Boyapati (24 Oct 2006)
. \ Ian Lance Taylor (24 Oct 2006)

Subject:namespaces composition and selection
Group:Gcc-help
From:Anitha Boyapati
Date:24 Oct 2006



Hi,

Here is the sample program I have written :

------------------------------------------------------------
#include "user_defined.h"

//using namespace user_defined;

int main()
{
user_defined::base *b=new user_defined::base();
b->display();

user_defined::base *y = new user_defined::base();
y->display();
}
---------------------------------------------------------

file : user_defined.h

#include "mine.h"
#include "yours.h"

namespace user_defined {

using namespace mine; //use all from mine
using namespace yours; //use all from yours

using yours::base; //resolve conflict for base in favour of yours
};

-------------------------------------------------------------

Both mine::base and yours::base exists.(base is again another class)
and as commented yours::base is favoured when there is a conflict.

The problem I encountered is, I cannot directly use any decalaration
related to base without scope resolution(user_defined::base).

What I want is : Can I not make it work with
using namespace user_defined;
alone(the part has been commented ).If comments are removed and scope
resolution is also removed, the compiler complaines of ambigous base
class type.

Can somebody pull me out?

[I am trying this example with gcc version 3.2.3 20030502.The example
is related to c++ Programming language by Stroustrup]

Thanks in advance.



--
Regards,
Anitha B.




© 2004-2008 readlist.com