Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Overloading

This is a discussion on Overloading within the OOPS forums, part of the Software Development category; Can overloading be done on return type? How?...

Go Back   Geeks Talk > Software Development > OOPS
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

OOPS Object-Oriented Programming Concepts

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-15-2009
Junior Member
 
Join Date: Nov 2007
Posts: 1
Thanks: 0
Thanked 1 Time in 1 Post
usmita is on a distinguished road
Overloading

Can overloading be done on return type? How?
Reply With Quote
The Following User Says Thank You to usmita For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 07-15-2009
Expert Member
 
Join Date: May 2009
Location: Bangalore
Posts: 991
Thanks: 155
Thanked 420 Times in 201 Posts
rijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nicerijus is just really nice
Re: Overloading

Hi,

It is an accepted fact that Java does not support return-type-based overloading.

This means that a class cannot have two methods that differ only by return type -- you can't have int doXyz(int x) and double doXyz(int x) in the same class. And indeed, the Java compiler duly rejects any such attempt

In the case of method overloading,

Methods cannot be overloaded only on the basis of return type atleast one argument should be different otherwise compiler will give the message The function is already defined in the class .


Thanks,
Riju.
Reply With Quote
  #3 (permalink)  
Old 08-08-2009
Junior Member
 
Join Date: Aug 2009
Location: india
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
murali_yerukola is on a distinguished road
Re: Overloading

only on return type it nt possible
ex int one(int a,int b);
float one (int a,int b)
this type is nt possible
Reply With Quote
Reply

  Geeks Talk > Software Development > OOPS

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Overloading of constructor amiomi C and C++ 2 03-20-2009 03:34 PM
Operator Overloading sivasubbu C# 5 07-26-2008 06:14 PM
Overloading Sub Programs. babi_geek Oracle 2 06-09-2008 06:17 AM
Operator overloading valireddy C and C++ 2 04-12-2008 07:34 AM
Function overloading example vicky19772003 Java 6 05-22-2007 10:43 AM


All times are GMT -4. The time now is 01:45 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved