Explain the interfaces in ruby, Data Structure & Algorithms

Explain the Interfaces in Ruby

Recall that in object-oriented programming, an interface is a collection of abstract operations that cannot be instantiated. Even though Ruby is object-oriented, it doesn't have interfaces. Interface-like classes can be constructed in Ruby by creating classes whose operations have empty bodies. These pseudo-interface classes can be used as super-classes of classes which implement the interface. Pseudo-interface classes can still be instantiated and their operations can still be known as without overriding them, so they are only a bit like real interfaces. One way to make them more like interfaces, though, is to implement the operations in pseudo-interface so that they raise exceptions if they are called. This forces sub-classes to override the operations in these pseudo-interface classes before they can be used.

 

Posted Date: 9/20/2013 2:26:25 AM | Location : United States







Related Discussions:- Explain the interfaces in ruby, Assignment Help, Ask Question on Explain the interfaces in ruby, Get Answer, Expert's Help, Explain the interfaces in ruby Discussions

Write discussion on Explain the interfaces in ruby
Your posts are moderated
Related Questions
Regis lives in Brazil and frequently travels to USA, Japan and Europe. He wants to be able to convert Brazilian Reais into US dollars, European euros and Japanese yen. Conversion f

Example 1:  Following are Simple sequence of statements Statement 1;  Statement 2; ... ... Statement k; The entire time can be found out through adding the times for

characteristics of a good algorithm

algorithm and flow chart to find weather the given numbers are positive or negative or neutral

Sequential files are most frequently utilized in commercial batch oriented data processing where there is the concept of a master file on which details are inserted periodically. F

Enumerate the Types in Ruby Ruby is a pure object-oriented language, meaning that all types in Ruby are classes, and each value in a Ruby program is an instance of a class. Thi

Determine in brief about the Boolean Carrier set of the Boolean ADT is the set {true, false}. Operations on these values are negation, conjunction, disjunction, conditional,

Q. Consider the specification written below of a graph G V(G ) = {1,2,3,4} E(G ) = {(1,2), (1,3), (3,3), (3,4), (4,1)} (i)        Draw the undirected graph. (

what algorithms can i use for the above title in my project desing and implmentation of road transport booking system

Q .  Write down the non-recursive algorithm to traverse a tree in preorder. Ans: T he Non- Recursive algorithm for preorder traversal is written below: Initially i