How call function from other class(self created) in ruby program

Discussion in 'Ruby' started by RAJU, Sep 24, 2009.

  1. RAJU

    RAJU Guest

    let I have 2 diff. program code at C drive: A.rb and B.rb
    ! A.rb is
    class A
    def a
    puts "Hello, I am in A"
    end
    end

    !B.rb is

    class B
    def b
    puts "I am in B"
    end
    end

    Know i want to call object of Class A of code A.rb in B.rb.
    So how can import Class A in B.what is syntax of importing.
    RAJU, Sep 24, 2009
    #1
    1. Advertising

  2. 2009/9/24 RAJU <>:
    > let I have 2 diff. program =A0code at C drive: =A0A.rb and B.rb
    > ! A.rb is
    > class A
    > =A0def a
    > =A0 =A0puts "Hello, I am in A"
    > =A0end
    > end
    >
    > !B.rb is
    >
    > class B
    > =A0def b
    > =A0 =A0puts "I am in B"
    > =A0end
    > end
    >
    > Know i want to call object of Class A of code A.rb in =A0B.rb.
    > So how can import Class A in B.what is syntax of importing.


    require 'A'

    Cheers

    robert


    --=20
    remember.guy do |as, often| as.you_can - without end
    http://blog.rubybestpractices.com/
    Robert Klemme, Sep 24, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ralf W. Grosse-Kunstleve
    Replies:
    16
    Views:
    559
    Lonnie Princehouse
    Jul 11, 2005
  2. Ralf W. Grosse-Kunstleve
    Replies:
    18
    Views:
    579
    Bengt Richter
    Jul 11, 2005
  3. Ralf W. Grosse-Kunstleve
    Replies:
    2
    Views:
    389
    Dan Sommers
    Jul 12, 2005
  4. falcon
    Replies:
    0
    Views:
    358
    falcon
    Jul 31, 2005
  5. Replies:
    6
    Views:
    101
    Vivek
    Jan 25, 2006
Loading...

Share This Page