Pytyon & Ruby & Atom

객체와 모듈

Python 

1.py 

import lib
obj = lib.A()
print(obj.a())

 lib.py

class A:
    def a(self):
        return 'a'

Ruby

1.rb

require_relative 'lib'
obj = Lib::A.new()
p obj.a()

lib.rb

module Lib
  class A
    def a()
      return 'a'
    end
  end
end

 

댓글

댓글 본문
버전 관리
egoing
현재 버전
선택 버전
graphittie 자세히 보기