How do I pass multiple parameters in Objective-C?

I have read several of the post about Objective-C method syntax but I guess I don’t understand multiple names for a method. I’m trying to create a method called getBusStops with NSString and NSTimeInterval parameters and a return type of NSMutableArray. This is how I have constructed the method but it obviously gets errors at … Read more

Can I invoke an instance method on a Ruby module without including it?

Background: I have a module which declares a number of instance methods module UsefulThings def get_file; … def delete_file; … def format_text(x); … end And I want to call some of these methods from within a class. How you normally do this in ruby is like this: class UsefulWorker include UsefulThings def do_work format_text(“abc”) … … Read more

Verify a method call using Moq

I am fairly new to unit testing in C# and learning to use Moq. Below is the class that I am trying to test. class MyClass { SomeClass someClass; public MyClass(SomeClass someClass) { this.someClass = someClass; } public void MyMethod(string method) { method = “test” someClass.DoSomething(method); } } class Someclass { public DoSomething(string method) { … Read more

Can a C++ enum class have methods?

I have an enum class with two values, and I want to create a method which receives a value and returns the other one. I also want to maintain type safety(that’s why I use enum class instead of enums). http://www.cplusplus.com/doc/tutorial/other_data_types/ doesn’t mention anything about methods However, I was under the impression that any type of … Read more

Should private helper methods be static if they can be static

Let’s say I have a class designed to be instantiated. I have several private “helper” methods inside the class that do not require access to any of the class members, and operate solely on their arguments, returning a result. public class Example { private Something member; public double compute() { double total = 0; total … Read more

Reflection: How to Invoke Method with parameters

I am trying to invoke a method via reflection with parameters and I get: object does not match target type If I invoke a method without parameters, it works fine. Based on the following code if I call the method Test(“TestNoParameters”), it works fine. However if I call Test(“Run”), I get an exception. Is something … Read more