Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7543441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:25:46+00:00 2026-05-30T08:25:46+00:00

Instead of supporting method overloading Ruby overwrites existing methods. Can anyone explain why the

  • 0

Instead of supporting method overloading Ruby overwrites existing methods. Can anyone explain why the language was designed this way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T08:25:47+00:00Added an answer on May 30, 2026 at 8:25 am

    Method overloading can be achieved by declaring two methods with the same name and different signatures. These different signatures can be either,

    1. Arguments with different data types, eg: method(int a, int b) vs method(String a, String b)
    2. Variable number of arguments, eg: method(a) vs method(a, b)

    We cannot achieve method overloading using the first way because there is no data type declaration in ruby(dynamic typed language). So the only way to define the above method is def(a,b)

    With the second option, it might look like we can achieve method overloading, but we can’t. Let say I have two methods with different number of arguments,

    def method(a); end;
    def method(a, b = true); end; # second argument has a default value
    
    method(10)
    # Now the method call can match the first one as well as the second one, 
    # so here is the problem.
    

    So ruby needs to maintain one method in the method look up chain with a unique name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Instead of using $this->fetchAll('email = ?',$email)->current() inside the model class, is there a way
Instead of returning a common string, is there a way to return classic objects?
Is anyone out there using the Prism framework with Ninject instead of Unity? I
What is the best way(s) to keep the User from getting confused by this
Is new Web API supporting pushing messages to clients (instead of continuous polling)?
I have site that I want to look like this: but instead it looks
Instead of something like this: Func<bool> func; bool Property { get {return func();} }
...instead of using the Atom syndication format? Atom is a well-defined , general-purpose XML
Instead of writing my ASP.NET C# applications in Visual Studio, I used my favorite
Instead of relying on my host to send an email, I was thinking of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.