Jump to content

[SOLVED] call function inside function


project-nz

Recommended Posts

I think you'll find its not.

 

yes it is

why would you need to say 'this'

when it knows its referencing functions inside the class?

 

 

 

Show me a language that doesn't use some sort of reference within a class definition to point an instance of that object to the right place.

 

python

class foo:
    def bar(self):
        print "this is bar"

    def bob(self):
        self.bar()

 

ruby

class foo
  def foo.bar()
    puts "this is bar"
  end

  def bob()
    foo.bar()
  end
end

 

I'm not saying all languages work this way, but most do.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.