On Thu, Mar 7, 2013 at 3:42 PM, john rxjmo <lists / ruby-forum.com> wrote:
> Hi,
> I'm new to ruby programming and I want to ask you if you can help me on
> this.
> I have created 3 classes (c1, c2, c3) and I want to do 3 sublasses (sc1,
> sc2, sc3).
>
> the classes are related.
>
> I want to define a method in cs1 (uses variables and methods from c1)
> and use it from sc2.
>
> When I run the module I get this error:
> I get this error : "NoMethodError: undefined method `r180' for
> #<c1:0x000000055683a8>
>
> sample code:
> class sc2 < c2
>   # this method (m1) is defined in c2
>   def m1
>     super
>     # I want to add this part
>     # @b: defined in c2 as an instance of c1
>     @r.bind('u', proc {@b.r180})
>   end
> end
>
> class sc1 < c1
>   # I added this method
>   def r180
>     # go, @gir, @cb.m() and d() are defined
>     # in c1
>     if !go? and @gir?
>       @cb.m()
>     end
>     d()
>   end
> end

Is r180 actually defined in c1? It would be easier to help if we could
see c1 and c2.