Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   operator overloading (http://www.programmingforums.org/showthread.php?t=15807)

Generic User #2 May 8th, 2008 7:19 PM

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?

JD-Salinger May 8th, 2008 11:52 PM

Re: operator overloading
 
Quote:

Originally Posted by Generic User #2 (Post 145010)
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

grumpy May 9th, 2008 4:45 AM

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. ;)


All times are GMT -5. The time now is 9:28 PM.

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