# Constructors

**URL:** <https://www.ruby-forum.com/t/constructors/196835>\
**Category:** Ruby\
**Created:** [November 3, 2008, 5:05pm UTC](https://www.ruby-forum.com/t/constructors/196835 "2008-11-03T17:05:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![exiquio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/77aa72/32.png) [@exiquio](https://www.ruby-forum.com/u/exiquio)\
**Post date:** [November 3, 2008, 5:05pm UTC](https://www.ruby-forum.com/t/constructors/196835/1 "2008-11-03T17:05:34Z")

</div>

The following is the beginning of a Java-esque new operator.

def new o  
o.class == Class ? o.new : o  
end

Used with the String class you can do:

new String # =\> “”  
new String(‘foo’) # =\> “foo”

But this is not the case with a class like Object:

new Object # okay  
new Object() # error

My question is, what are classes like Array and String defining that  
Object isn’t? And how can I define my own? Thanks in advanced.
