Why cann't we overload the sizeof, :?, :: ., .* operators in c++

Showing Answers 1 - 6 of 6 Answers

sabita

  • Aug 10th, 2006
 

The restriction is for safety.For example if we overload . operator then we cant access member in normal way for that we have to use ->.

  Was this answer useful?  Yes

Andrew Berstan

  • Aug 12th, 2006
 

Because it will not help write a clear program. If we overload sizeof, :?, ::, it will cause a lot of confuse rather than make program more easier to understand.

Amritanshu Agrawal

  • Sep 5th, 2006
 

Hi all,

Firstof all only .,:: and .* operators never be overladed.

Because They take name, rather than a value,as their socound operand and provide the primary means of reffering to members.Allowing them to be overloaded would lead to subtlety.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions