Task

The goal is to get the methods of an object, as names, values or both.

Some languages offer dynamic methods, which in general can only be inspected if a class' public API includes a way of listing them.

// create a class with methods that will be listed
class Methods
	def static method1()
		return "this is a static method. it will not be printed"
	end
	def method2()
		return "this is not a static method"
	end
 
	def operator=(other)
		// operator methods are listed by both their defined name and
		// by their internal name, which in this case is isEqual
		return true
	end
end
 
// lists all nanoquery and java native methods
for method in dir(new(Methods))
	println method
end