Explain the interfaces in ruby, Data Structure & Algorithms

Assignment Help:

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.

 


Related Discussions:- Explain the interfaces in ruby

Algorithm, Example of worse case of time

Example of worse case of time

Time converstion, how to convert 12 hour format into 24 hour format using c...

how to convert 12 hour format into 24 hour format using c program

Which sorting algorithm is adaptable to singly linked list, Which sorting a...

Which sorting algorithm is easily adaptable to singly linked lists? Simple Insertion sor t is easily adabtable to singly linked list.

Numerical - algorithm, Q. What is the smallest value of n such that an algo...

Q. What is the smallest value of n such that an algorithm whose running time is 100n2 runs faster than an algorithm whose running time is 2n on the same machine.    A n

Post order traversal, Post order traversal: The children of node are vi...

Post order traversal: The children of node are visited before the node itself; the root is visited last. Each node is visited after its descendents are visited. Algorithm fo

Explain time complexity, Time Complexity, Big O notation The amount of ...

Time Complexity, Big O notation The amount of time needed by an algorithm to run to its completion is referred as time complexity. The asymptotic running time of an algorithm i

Stack, using a program flowchart design a program to illustrate pop and pus...

using a program flowchart design a program to illustrate pop and push operation

Column major representation, Column Major Representation In memory th...

Column Major Representation In memory the second method of representing two-dimensional array is the column major representation. Under this illustration, the first column of

Determine the class invariants- ruby, Determine the class invariants- Ruby ...

Determine the class invariants- Ruby Ruby has many predefined exceptions classes (like ArgumentError) and new ones can be created easily by sub-classing StandardError, so it's

Explain divide and conquer algorithms, Explain divide and conquer algorithm...

Explain divide and conquer algorithms  Divide  and  conquer  is  probably  the  best  known  general  algorithm  design  method.  It   work according to the following general p

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd