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
Rails Application Using Active Merchant
5 years ago


3 comments:
人生是故事的創造與遺忘。 ..................................................
偉大的致富萬能之鑰,正是幫你充分掌握自己心志所必須的自律自制........................................
thanks................................................
Post a Comment