A
Avinash
Hi,
Why Overloaded operator [] cannot be a friend ?
Thanking You.
Avinash
Why Overloaded operator [] cannot be a friend ?
Thanking You.
Avinash
Avinash said:Why Overloaded operator [] cannot be a friend ?
Avinash said:Hi,
Why Overloaded operator [] cannot be a friend ?
Mike Wahler said:Avinash said:Hi,
Why Overloaded operator [] cannot be a friend ?
Why can't birds fly?
What C++ book(s) are you reading?
-Mike
Mike Wahler said:Avinash said:Hi,
Why Overloaded operator [] cannot be a friend ?
Why can't birds fly?
What C++ book(s) are you reading?
-Mike
I don't know about the OP, but I read the following in Stroustrup (TCPL, p.
287):
"An operator[]() must be a member function."
In Lippman's C++ Primer (p. 754), I read:
"A subscript operator must be defined as a class member function."
I also read in the C++ standard:
13.5.5 Subscripting
1 operator[] shall be a non-static member function with exactly one
parameter.
tom_usenet said:I don't know about the OP, but I read the following in Stroustrup
(TCPL, p. 287):
"An operator[]() must be a member function."
In Lippman's C++ Primer (p. 754), I read:
"A subscript operator must be defined as a class member function."
I also read in the C++ standard:
13.5.5 Subscripting
1 operator[] shall be a non-static member function with exactly one
parameter.
None of that stops operator[] from being a friend:
struct A
{
void operator[](int){}
};
struct B
{
friend void A:perator[](int);
};
Tom
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.