470,833 Members | 1,251 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,833 developers. It's quick & easy.

the use of the :: operator

Hello All,

Assume:

class AnObjectType{
typedef std::list <AnotherObjectType> Collection;
typedef SmartIterator <Collection> Iterator;
Iterator get( void);
Collection mCollection;
}

AnObjectType::Iterator AnObjectType::get( ){ //does Iterator need to be
qualified (AnObjectType::) here, and why?
Collection::iterator scit ;
return AnObjectType::Iterator(mServiceCollection); //does Iterator need
to be qualified here, and why?
}

TIA
Apr 9 '06 #1
1 1357
jimjim wrote:
Assume:

class AnObjectType{
typedef std::list <AnotherObjectType> Collection;
typedef SmartIterator <Collection> Iterator;
Iterator get( void);
Collection mCollection;
} ;

AnObjectType::Iterator AnObjectType::get( ){ //does Iterator need to
be qualified (AnObjectType::) here, and why?
Yes, it does.
Collection::iterator scit ;
return AnObjectType::Iterator(mServiceCollection); //does Iterator
need to be qualified here, and why?
No, it does not.
}


The rest of the homework you need to do yourself. Find a good book
and read the explanation of the rules for "name lookup".

V
--
Please remove capital As from my address when replying by mail
Apr 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by joesoap | last post: by
reply views Thread by Martin Magnusson | last post: by
3 posts views Thread by Sensei | last post: by
6 posts views Thread by YUY0x7 | last post: by
3 posts views Thread by gugdias | last post: by
8 posts views Thread by valerij | last post: by
3 posts views Thread by y-man | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.