Why can't we overload certain operators in Turbo C++. Like ::, ?:, .* etc. ?
and What is the reason why can't we overload some more operators like [],() etc
with Friend functions ?
(1) You cannot overload # and ## they are used by the preprocessor
(2) you cannot overload . .* :: ?: sizeof as they a fundamental operators, i.e. to access class members, resolve scope, etc
When overloading the operators =, [], () and -> the associated functions operator=, operator[], operator() and operator-> must be non-static member functions. This is to ensure that the first operand (pointed to by the hidden parameter this) is an lvalue (the general name for an expression referring to a region of storage in memory). In addition, constructors, destructors and virtual functions must be members.