如何从不同的类调用类的实例上的实例方法

时间:2016-08-15 19:54:07

标签: ruby

所以我有以下设置

class foo
    :attr_accessor :textBoxInFoo

    @textBoxInFoo

    def appendText
        //appends text to textBoxInFoo
    end

    def getLastPartOfText
        //gets the last line of text in textBoxInFoo
    end
end

class bar
    def UseFoo
        //Declares instance of textBoxInFoo
    end
end

class snafu
     def runInBackground
         //Needs to read and write from instance of textBoxInFoo in bar class
     end
end

我没有意识到的是如何在runInBackground中做我需要做的事情来让它读取和写入textBoxInFoo,我一直在阅读实例和类方法的各种解释,而且没有一个有真的和我点击了,所以我想知道是否有人知道我搞砸了什么。

0 个答案:

没有答案
相关问题