# How to inherit from other class in different level

**URL:** <https://www.ruby-forum.com/t/how-to-inherit-from-other-class-in-different-level/196791>\
**Category:** Ruby\
**Created:** [August 25, 2008, 5:23pm UTC](https://www.ruby-forum.com/t/how-to-inherit-from-other-class-in-different-level/196791 "2008-08-25T17:23:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [August 25, 2008, 5:23pm UTC](https://www.ruby-forum.com/t/how-to-inherit-from-other-class-in-different-level/196791/1 "2008-08-25T17:23:30Z")

</div>

Hi, I’ve a problem since I need a Class to inherit from other Class  
that is in other level. The problem is this:

* * *

module SIP  
class SipUri  
class SipUriParameters  
end  
end  
end

## module SIP class TelUri class TelUriParameters \< SipUriParameters end end end

NameError: uninitialized constant SIP::TelUri::SipUriParameters  
from (irb):9

Well, I can solve it by using:

class TelUriParameters \< SIP::SipUri::SipUriParameters

but is not other way? Thanks a lot.

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [August 25, 2008, 5:30pm UTC](https://www.ruby-forum.com/t/how-to-inherit-from-other-class-in-different-level/196791/2 "2008-08-25T17:30:37Z")

</div>

> Well, I can solve it by using:
> 
> class TelUriParameters \< SIP::SipUri::SipUriParameters
> 
> but is not other way? Thanks a lot.

if you include the SIP::SipUri namespace in your script , you could be  
using only class TelUriParameters \< SipUriParameters

---

<div class="post-metadata">

**Author:** ![ISSSSaki\_Baz\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/51bf81/32.png) [@ISSSSaki\_Baz\_C](https://www.ruby-forum.com/u/ISSSSaki_Baz_C)\
**Post date:** [August 25, 2008, 5:51pm UTC](https://www.ruby-forum.com/t/how-to-inherit-from-other-class-in-different-level/196791/3 "2008-08-25T17:51:38Z")

</div>

2008/8/25, Lex W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> using only class TelUriParameters \< SipUriParameters  
> Ok, I understand. So then I prefer to using:  
> class TelUriParameters \< SIP::SipUri::SipUriParameters

Thanks a lot
