class Foo
  def self.create
    klass = Class.new(Foo)
#    klass.class_eval do; @@base = 1;  end #NG statically
    klass.class_eval "@@base = 1"
    klass.class_eval "def bar; @@base; end"
    klass.class_eval "def self.baz; @@base; end"
    klass
  end
  
  def foo; @@base; end
  def baz; type.baz; end
end


Bar = Foo.create

#p Bar.new.foo # NG
p Bar.new.bar
p Bar.new.baz





