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

R

RAJU

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.
 
R

Robert Klemme

2009/9/24 RAJU said:
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/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top