SHARE
TWEET

Untitled

a guest Mar 5th, 2019 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class A
  2.   def initialize
  3.     print self.class
  4.     print self
  5.     raise 'abstract class' if (self.class == A)
  6.   end
  7. end
  8.  
  9. class B < A
  10. end
  11.  
  12. begin
  13.   A.new
  14.   puts "A did not raise an error"
  15. rescue
  16.   puts "A raised an error"
  17. end
  18.  
  19. begin
  20.   B.new
  21.   puts "B did not raise an error"
  22. rescue
  23.   puts "B raised an error"
  24. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top