module NowModule
class NowModuleOne
class << self
def find
p "This is intresting!!!"
end
end
end
end
class Parent < NowModule::NowModuleOne
def parentone
puts "This is the parent class!!!"
#parentprotected
#parentprivate
end
class << self
def parentself
puts "This is the self one!!!"
end
end
protected
def parentprotected
puts "This is the protect one!!!"
end
private
def parentprivate
puts "This is the private one!!!"
end
end
#example of inheritance....
class Child < Parent
def childone
Parent.find
p parentone
puts "This is the child class!!!"
end
end
#example of multiple level inheritance
class ChildOfChild < Child
def childofchildone
#the parentone belongs to the parent class which a base class for the Child class..
parentone
end
end
p = Parent.new
c = Child.new
cc = ChildOfChild.new
#cc.childofchildone
c.childone
#c.parentpivate
Thursday, October 8, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment