Last week, I was dealing with the use of “mixins” and its impact on method overwriting and overloading.
Some research after, could summarize on this:
- Multiple inheritance IS NOT supported in Ruby.
- Ruby supports SINGLE inheritance AND “mixins”.
- IF you know how (that is the question) "mixins could do almost everything multiple inheritance do, without the associated drawbacks" (Matz words).
- Overriding or overwriting methods, for programming purposes, means the same: Change or redefine a method that already exists in the given context.
- In Ruby classes are always open so, methods may be added or changed.
- Overloading comes from languages other than Ruby. Where you can define methods with the same name but with different argument types and quantities (signatures).
- Ruby is an all OOP language, for example the "+" operator is a method of the "Object" class.
- If you overwrite a mixed-in "+" method, you could use such modified/overwritten method on the main-object (Object class).
- Remember: everything in Ruby is an object.
At that point, the next step was show some code examples about that, but there is a problem. It’s not easy to put code (on a presentable way) on blogs.
On most popular blogs, there are some kinds of work to do before you can put your code there.
So, I decide not to waste time on that subject, and will select a more specialized resource to put my code and reference it here.
Suggestions welcome!
2 comments:
Do give a look here:
http://adhirajrankhambe.wordpress.com/2009/01/04/a-word-about-modules-in-ruby/
It is nice blog Thank you provide important information and i am searching for same information to save my time
Ruby on Rails Online Training Bangalore
Post a Comment