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 8075133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:53:28+00:00 2026-06-05T14:53:28+00:00

I have read in many textbooks that In Ruby,a class can only be a

  • 0

I have read in many textbooks that

In Ruby,a class can only be a subclass of one class. Mixins, however, allow classes without a common ancestor to share methods.

In practice, whenever I need to implement multiple inheritance. I have use Modules & not mixins. for example:

Module name_goes_here
  def method_name_goes_here
    .....
  end
end

Then, I just include them in a class

class MySubClass < MySuperClass
  include module_name
end

now, I have referred to multiple ruby books each talking about mixins & then suddenly, all of they start talking about modules without making it clear what is the relation of mixins & modules.

so, Question is:
Are modules == mixins in ruby? if yes, then why. if no, then what’s the difference?

PS: sorry, if its a silly question

  • 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-06-05T14:53:31+00:00Added an answer on June 5, 2026 at 2:53 pm

    Mixins are a language concept that allows to inject some code into a class.

    This is implemented in Ruby by the keyword include that takes a Module as a parameter.

    So yes, in Ruby, mixins are implemented with modules. But modules have other uses than mixins.

    For example, modules can also be used for namespacing your classes or encapsulating utility functions to keep from polluting the global namespace.

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

Sidebar

Related Questions

i have read many articles that can be found on soap , i am
I have read many post indicating that we can't send sms on Missed Call,
I have read so many times, here and everywhere on the net, that mutexes
I have read many article about this one. I want to hear from you.
I am trying to create a NSMutableDictionary in my class. I have read many
i have read many posts but can not find my answer.my question is a
I have read many articles about XML parsing in Android. However, all of them
I have read many other posts on here that state the same issue and
I have read many times on the web that when dealing with dependency in
I have read many documentation about static variables. Here is one example which I

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.