# Re: A question about metaclass

**URL:** <https://www.ruby-forum.com/t/re-a-question-about-metaclass/49940>\
**Category:** Ruby\
**Created:** [November 24, 2005, 3:19am UTC](https://www.ruby-forum.com/t/re-a-question-about-metaclass/49940 "2005-11-24T03:19:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniels](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@daniels](https://www.ruby-forum.com/u/daniels)\
**Post date:** [November 24, 2005, 3:19am UTC](https://www.ruby-forum.com/t/re-a-question-about-metaclass/49940/1 "2005-11-24T03:19:56Z")

</div>

> My question is where the C.new method is.  
> The class Class or C’s singleton class?
> 
> According to PickAxe2, it seems that C.new is in Class.  
> However, according to Little Ruby book, it seems that C.new  
> is in C’s metaclass.

class C  
end

C.new #executed new from Class

class C  
def new(arg)  
p “ARGGGHHH!! #{arg}”  
super.new  
end  
end

C.new #executed new from C’s metaclass/singleton class/eigenclass.  
#####################################################################################  
This email has been scanned by MailMarshal, an email content filter.  
#####################################################################################

---

<div class="post-metadata">

**Author:** ![daniels](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/3ab097/32.png) [@daniels](https://www.ruby-forum.com/u/daniels)\
**Post date:** [November 24, 2005, 3:56am UTC](https://www.ruby-forum.com/t/re-a-question-about-metaclass/49940/2 "2005-11-24T03:56:09Z")

</div>

Hi –

On Thu, 24 Nov 2005, Daniel S. wrote:

> C.new #executed new from Class
> 
> class C  
> def new(arg)

You’re defining C#new (an instance method of C). Do you mean to  
define:

def C.new(arg)

?

> p “ARGGGHHH!! #{arg}”  
> super.new

If you are defining C.new, then super will return an instance of C:

class C  
def C.new  
super  
end  
end

C.new # #\<C:0x355e9c\>

If you call new on that object, you’ll get an NoMethodError 🙂

> end  
> end

See if this helps:

class C  
end

p C.new

def C.new  
puts “Here”  
super  
end

p C.new

> C.new #executed new from C’s metaclass/singleton class/eigenclass.

(class \<\< obj; self; end) is obj’s singleton class. Sometimes the  
singleton class of a class object is also called a “metaclass” (though  
there’s been debate as to whether a separate term is needed, and  
whether “metaclass” is the best separate term). “Eigenclass” is just  
one of maybe 25 words that have been suggested for a future “official”  
term, since Matz has said he’s thinking about what the best term might  
be.

David
