#### Archived

This topic is now archived and is closed to further replies.

## Recommended Posts

I'm just learning these two subjects, and I think I understand them separately, but when I put them together I have problems. So let's say I have a template and I want to overload an operator like so:

template <class cType> class dArray
{public:
cType arrayVariable[1024];
dArray operator[](int numToReturn);
};

// then outside of the class:

template <class cType> cType dArray<cType>::operator[](int numToReturn)
{
return arrayVariable[numToReturn];
}


It's throwing an error when I write this. Could someone help me out. I haven't found any tutorials that do this. Only tutorials that do one or the other, and I've had to try to put it together on my own, unsuccessfully. --Vic-- The future of 2D game development: Flat Red Ball

##### Share on other sites
The return type in the member function declaration differs from the return type of its definition.

##### Share on other sites
All I have to say is HAHAHAHAHAHHAHA. Thanks so much, Null and Void. I was so concerned with getting the function written correctly that I totally overlooked that.

--Vic--

The future of 2D game development:
Flat Red Ball

• ### Forum Statistics

• Total Topics
628394
• Total Posts
2982427

• 10
• 9
• 19
• 24
• 9