fork(3) download
  1. class Test
  2. def setup
  3. end
  4.  
  5. def initialize
  6. setup
  7. end
  8. end
  9.  
  10. class Common < Test
  11. def test_no_id
  12. puts "Inside #{self} it is #{@state}"
  13. end
  14. end
  15.  
  16. class A < Common
  17. def setup
  18. @state = "A"
  19. end
  20. end
  21.  
  22. class B < Common
  23. def setup
  24. @state = "B"
  25. end
  26. end
  27.  
  28. A.new.test_no_id
  29. B.new.test_no_id
  30.  
Success #stdin #stdout 0s 4716KB
stdin
Standard input is empty
stdout
Inside #<A:0x88a4f78> it is A
Inside #<B:0x88a4f00> it is B