# Calling instance method defined in a parent class?

**URL:** <https://www.ruby-forum.com/t/calling-instance-method-defined-in-a-parent-class/115636>\
**Category:** Ruby\
**Created:** [September 27, 2007, 2:17am UTC](https://www.ruby-forum.com/t/calling-instance-method-defined-in-a-parent-class/115636 "2007-09-27T02:17:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Christopher\_JSBott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@Christopher\_JSBott](https://www.ruby-forum.com/u/Christopher_JSBott)\
**Post date:** [September 27, 2007, 2:17am UTC](https://www.ruby-forum.com/t/calling-instance-method-defined-in-a-parent-class/115636/1 "2007-09-27T02:17:10Z")

</div>

How do I do that? Consider the following class definitions:

class Foo  
def a  
puts “Foo”  
end  
end

class Bar \< Foo  
def a  
puts “Bar”  
end  
def b  
parent.a # I want to call Foo#a here for this instance of Bar.  
end  
end

Bar.new.b # =\> “Foo”

Thanks for the help.

---

<div class="post-metadata">

**Author:** ![Christopher\_JSBott](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/ee7513/32.png) [@Christopher\_JSBott](https://www.ruby-forum.com/u/Christopher_JSBott)\
**Post date:** [September 27, 2007, 3:05am UTC](https://www.ruby-forum.com/t/calling-instance-method-defined-in-a-parent-class/115636/2 "2007-09-27T03:05:38Z")

</div>

On Sep 26, 5:16 pm, “Christopher J. Bottaro” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> How do I do that? Consider the following class definitions:

class Foo  
def a  
puts ‘foo’  
end  
end

class Bar \< Foo  
alias b a

def a  
puts ‘bar’  
end  
end

Foo.new.a # =\> foo  
Bar.new.a # =\> bar  
Bar.new.b # =\> foo

> def b  
> parent.a # I want to call Foo#a here for this instance of Bar.  
> end  
> end
> 
> Bar.new.b # =\> “Foo”
> 
> Thanks for the help.

No problem.
