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
Question 1. Explain the different types of traversal on binary tree 2. Explain the Prim's minimum spanning tree algorithm 3. Differentiate fixed and variable storage allo

an electrical student designed a circuit in which the impedence in one part of a series circuit is 2+j8 ohms and the impedent is another part of the circuit is 4-j60 ohm mm program

B-trees are special m-ary balanced trees utilized in databases since their structure allows records to be added, deleted & retrieved with guaranteed worst case performance. A B-

Representation of Linked list in Memory:- Each node has an info part and a pointer to the next node also known as link. The number of pointers is two in case of doubly linked

Explain the Assertions in Ruby Ruby offers no support for assertions whatever. Moreover, because it's weakly typed, Ruby doesn't even enforce rudimentary type checking on opera


Indexed Sequential Files An index is inserted to the sequential file to provide random access. An overflow area required to be maintained to permit insertion in sequence. I

Double Linked List In a doubly linked list, also known as 2 way lists, each node is separated into 3 parts. The first part is called last pointer field. It has the address of t

Binary Space Partition A binary space-partitioning (BSP) tree is an efficient method for determining object visibility by painting surfaces onto the screen from back to front,

Explain the halting problem Given a computer program and an input to it, verify whether the program will halt on that input or continue working indefinitely on it.