Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 8th, 2008, 7:19 PM   #1
Generic User #2
Newbie
 
Join Date: Apr 2008
Posts: 6
Rep Power: 0 Generic User #2 is on a distinguished road
operator overloading

i was wondering about the array subscript operator in particular("[]"), is there a limit to how many arguments can be passed through it?
Generic User #2 is offline   Reply With Quote
Old May 8th, 2008, 11:52 PM   #2
JD-Salinger
Unknown
 
JD-Salinger's Avatar
 
Join Date: Apr 2008
Location: unknown
Posts: 79
Rep Power: 1 JD-Salinger is on a distinguished road
Re: operator overloading

Quote:
Originally Posted by Generic User #2 View Post
i was wondering about the array subscript operator in particular("[]"), is there a limit to how many arguments can be passed through it?
T operator [] (int i) const;

i think it can only be overloaded with one argument
__________________
-------------------------------------------------------------------------
I thought what I'd Do was, I'd pretend to be one of those deaf mutes
------------------------------------------------------------------------

Last edited by JD-Salinger; May 9th, 2008 at 12:09 AM. Reason: wrong answer
JD-Salinger is offline   Reply With Quote
Old May 9th, 2008, 4:45 AM   #3
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,206
Rep Power: 5 grumpy is on a distinguished road
Re: operator overloading

The standard states that operator[] is a non-static member that accepts exactly one argument.

operator() is a non-static member that accepts an arbitrary number of parameters.
grumpy is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:12 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC