I'm writing a handle for a class. How can I overload * and -> operator?
I can't find one on Google
Jump to content
Posted 10 January 2013 - 03:27 PM
You overload them exactly the same way you would overload any other operator.
A caveat with A::operator->() must be a nonstatic member function. (This also applies to =, , and () operators.)
The others can be either a nonstatic member function, or they can be a nonmember function with at least one parameter referencing the class.
Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.
Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.