³õѧruby Ôõô°ÑÒ»¸öÀർÈëÄØ
1. ÀýÈçÔÚ
Person.rb ÖÐ
Python code:
class Person
def talk
puts "nihao"
end
end
Student.rb
Python code:
class Student < Person
def talk
puts "nihao"
end
end
p = Student.new
p.talk
½á¹û
>ruby Student.rb
Student.rb:1: uninitialized constant Person (NameError)
>Exit code: 1
¾µä ¿á£¡ book_simmone
×Ô¼ºÌí¼ÓrequireÉÏÈ¥¾ÍÐÐÁË¡«¡«¡«²»¹ý·¢ÏÖcsdn ruby on rails Ã²ËÆÈ˲»¶à°¢¡«¡«
²»ÓÃÄÇôÂé·³µÄ£¬ÔÚrubyÖУ¬include¾Í¿ÉÒÔʵÏּ̳Ð
Python code:
class Student
include Person
def talk
puts "nihao"
end
end
Ïà¹ØÎÊ´ð£º
ÎÒ×Ô¼ºÐ´ÁËÒ»¸ö¿âÎļþ£¬¿âÎļþÄÚ²¿Ã»ÎÊÌâ¡£ÎÒÏÖÔÚÏëÓà ruby£¨rpgÀµ÷ÓÃÕâ¸ö¿â£¬ÏÖÔÚÎÊÌâ³öÀ´ÁË£¬±¨´í£¬ËµµÄÊÇGetProcAddress : nSrv or nSrvA ºÃÏñÊDz»ÄÜÕÒµ½Õâ¸öº¯Êý°É£¬ nSrv ÊÇÎÒ¿âÎļþÀïµÄÒ»¸öº¯ÊýµÄÃû× ......
Ö÷Òª×öÄĸö·½ÃæµÄ£¿ÊDZàÒëÐ͵Äô£¿
Ò»Ãűà³ÌÓïÑÔ£¬²»ÊDZàÒëÐ͵Ä
¿´¿´ÕâÀï°É:
http://www.ruby-lang.org/en/
rubyÊÇһÎâÊÍÐ͵ÄÃæÏò¶ÔÏóÓïÑÔ¡£×î¾ß´ú±íµÄÓ¦ÓÃÊÇrails---web¿ìËÙ¿ª·¢¿ò¼Ü
......
require 'app/configuration'
module RubyAMF
module Configuration
#set the service path used in all requests
# RubyAMF::App::RequestStore.service_p ......
1. ÀýÈçÔÚ
Person.rb ÖÐ
Python code:
class Person
def talk
puts "nihao"
end
end
Student.rb
Python code:
class Student < Person
def talk
puts &quo ......