inheriting a ruby class from different file location

D

David E.

So I'd like to inherit a ruby class as such:

class ClassOne < ClassOneA

def blah1
end
def blah2
end

end


The caveat is that ClassOneA is NOT in the same file location as
ClassOne. How do I allow for ClassOne to "look for" ClassOneA.

Would i have to "require" it and then inherit it?

Thanks in advance!
 
P

Phillip Gawlowski

So I'd like to inherit a ruby class as such:

class ClassOne < ClassOneA

=A0def blah1
=A0end
=A0def blah2
=A0end

end


The caveat is that ClassOneA is NOT in the same file location as
ClassOne. How do I allow for ClassOne to "look for" ClassOneA.

Would i have to "require" it and then inherit it?

Yes.

--=20
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.
 
R

Robert Klemme

So I'd like to inherit a ruby class as such:

class ClassOne< ClassOneA

def blah1
end
def blah2
end

end


The caveat is that ClassOneA is NOT in the same file location as
ClassOne. How do I allow for ClassOne to "look for" ClassOneA.

Would i have to "require" it and then inherit it?

You would require the file ClassOneA is defined in - it need not
necessarily be named after the class.

Kind regards

robert
 

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

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top