Original Post
Hi all, I'm asking this out of interest rather then because it's a feature I absolutly need, but whats the best way to give a function multiple names in C++? Let's say I have a vector class with three functions - getX(), getY(), and getZ(). Now many people use a different convention and like to call the vector component i,j, and k so i'd also like to supply getI(), getJ(), and getK() functions which do exactly the same as thier x,y,z counterparts. Whats the best way to achieve this? I see several options: 1) Copy and paste the code and rename functions. 2) Have getI() call getX() internally. 3) Clever tricks with functions pointers/references?! 4) Clever tricks with templates? Although not exactly critical, I do believe this would be a useful language feature. Maybe some languages provide it already? Any thoughts? David