GeekInterview.com
Series: Subject: Topic:
Question: 9 of 38

Friend Function Overload

Why friend function cannot be used to overload the assignment operator?
Asked by: surendra_sahu786 | Member Since Aug-2008 | Asked on: Aug 30th, 2008

View all questions by surendra_sahu786   View all answers by surendra_sahu786

Showing Answers 1 - 4 of 4 Answers

In java it is not possible to overloading OPERATOR such as +/-/* etc. We can do that is C++.

In java there won't be any friend function.

Yes  1 User has rated as useful.
  
Login to rate this answer.
dheerendra

Answered On : Sep 2nd, 2008

View all answers by dheerendra

The concept operator overloading and friend function are supported by Java, by defaault only + operator is overloaded over string .

For example ---

String abc ="";
String s1="Hello";
String s2 = " Geek Interview";
abc = s1+s2;
Sop(abc);
would print Hello Geek Interview

  
Login to rate this answer.

In Java it is not possible to overloading OPERATOR such as +/-/* etc. We can do that is C++.
In Java there won't be any friend function. ...
That is why we can't use friend function overloading in Java

  
Login to rate this answer.
pavanbitsgoa

Answered On : Jan 5th, 2011

View all answers by pavanbitsgoa

Java is actually designed to work same as C++ but avoid complex features like operator overloading, friend functions, multiple inheritence.

Yes  1 User has rated as useful.
  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.