class One
{
private:
int _x;
public:
int* getPx() { return &_x; }
};
class Two
{
private:
int* _pY;
public:
void setPy( int* pY ) { _pY = pY; }
};
Do I need to use One::int* instead of plain int* ?
[edited by - flamewill on August 8, 2003 2:14:21 AM]
Pointer to data member?
According to ANSI C++, does a pointer to a data member need to be clarified by the namespace? For example:
You'd only need to clarify the namespace if it's a custom type created within a class, such as an enumeration or nested class. Of course this includes if it was created in another namespace, in which case you'd need it also.
[edited by - Zipster on August 8, 2003 2:23:50 AM]
[edited by - Zipster on August 8, 2003 2:23:50 AM]
AFAIK (second post I''ve seen so far today with them) isn''t one underscore on variable names a big no-no by the standard?
quote:Original post by antareus
AFAIK (second post I''ve seen so far today with them) isn''t one underscore on variable names a big no-no by the standard?
It is? I''m just a beginner who saw some books do it and thought it is a neat idea. If there is any particular reason the standard discourages it, I''d like to know please.
I forgot to mention, that also includes
As for the naming, I believe it conflicts with something else. Not sure though.
typedef
s created within a class.As for the naming, I believe it conflicts with something else. Not sure though.
Identifiers beginning with leading underscores are reserved for the implementation. A standard header file could #define _x to mean anything it wants.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement