class Model
def initialize()
puts "Model initialize\n"
end
def see
puts " table is " + @table
end
def add(u)
puts "insert into " + @table+ "values " +u
end
end
-------------------------------------------
class User < Model
def initialize
@table='user'
puts "User Initalize"
end
def log
print @table
end
end
a=User.new
a.see
u="xxx"
a.add(u)
a.log
如果只看父类,会不会觉得这个@table变量不知道是从哪冒出来的