# Different between Door::new and Door.new

**URL:** <https://www.ruby-forum.com/t/different-between-door-new-and-door-new/91397>\
**Category:** Ruby\
**Created:** [April 8, 2007, 7:55am UTC](https://www.ruby-forum.com/t/different-between-door-new-and-door-new/91397 "2007-04-08T07:55:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ming\_en\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/57b2e6/32.png) [@Ming\_en\_C](https://www.ruby-forum.com/u/Ming_en_C)\
**Post date:** [April 8, 2007, 7:55am UTC](https://www.ruby-forum.com/t/different-between-door-new-and-door-new/91397/1 "2007-04-08T07:55:03Z")

</div>

may i know what is the different between Door::new and Door.new  
i seem to work the same.

---

<div class="post-metadata">

**Author:** ![Ming\_en\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/57b2e6/32.png) [@Ming\_en\_C](https://www.ruby-forum.com/u/Ming_en_C)\
**Post date:** [April 8, 2007, 1:25pm UTC](https://www.ruby-forum.com/t/different-between-door-new-and-door-new/91397/2 "2007-04-08T13:25:14Z")

</div>

The :: operator and the . operator only behave differently when  
constants are involved AFAIK.

Foo::Bar will only look for the constant and raise an exception  
otherwise.  
Foo::Bar() and Foo::Bar X will only look for a method.  
Foo.Bar will only look for a method.

Otherwise the :: operator is equivalent to the . operator, even for  
non-module/class objects:

5::to\_s # =\> “5”  
5::+ 6 # =\> 11
