[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

RE: c++: 2D array



the signature for operator[] becomes same
T& operator[] (int i)
T* operator[] (int i)

The return type is not considered a s a part of the sginature
The compiler will face ambiguity in resolving which function to call

Anyway, I think we should have (const unsigned int) as the index parameter 

Sojan, I do not think we have met :( but were you in IBM /delhi-lug ?
Maybe we have crossed over personal emails at LI (old) etc ?

Anyway, great meeting C++ fanatix :)

Shourya



#-----Original Message-----
#From: Sojan James [mailto:sojan@xxxxxxxxxxxxxxxx]
#Sent: Friday, September 22, 2000 11:21 AM
#To: linux-india-programmers@xxxxxxxxxxxxxxxxxxxxx
#Subject: Re: [LIP] c++: 2D array
#
#
#T* operator[](int i) should do it.
#
#SOj.
#
#On Fri, 22 Sep 2000, Shridhar Daithankar wrote:
#
#> Hi all
#> 
#> What's the function prototype for overloading [][]operator?
#> 
#> I think of following..
#> 
#> T&        operator[](int i);
#> T*      operator[](T& ptr);
#> 
#> What do you think?
#> 
#>  Bye
#>   Shridhar
#> 
#> 
#-- 
#Sojan James
#National Semi. India Designs Ltd.
#7/6 Brunton Road, Bangalore 560025. India.
#Ph: 5587918/919/920 ext. 308
#
#
#
#
#
#
#---------------------------------------------
#Find out more about this and other Linux India
#mailing lists at http://lists.linux-india.org/
#