method-signature

C# - Override <T> method signature with ClassName?

Is there a way to override an abstract class's method signature which uses <T> with a ClassName so I can pass an object by reference without recasting it? For example, I have a bunch of Object Managers. I want them all to contain a .Save(Object) method which will perform the appropriate save action based on the object state (Insert, Upd...

C++: inheriting overloaded non-virtual method and virtual method both with the same name causes problem

Hi all, I am trying to inherit two equally named methods with different parameter lists to a derived class. One of them is virtual and overridden in the derived class, the other one is non-virtual. Doing so, i get a compile error while trying to access the non-virtual method of the base class from an derived class object. Here is the ...

Can I have a method argument typed "this class"?

I want to have an argument of type "this class" in an interface's method signature, so that any class, for example MyClass, implementing it will have that method with an argument of type MyClass.public interface MyInterface { public thisClass myMethod(thisClass other); ... }public class MyClass implements MyInterface { // has...

Why are jQuery's callback arguments inconsistent?

A common pattern within jQuery is a method that takes a callback which is passed an element of an array and its index within that array. However, it seems completely random which argument comes first. For example, from the jQuery docs at http://api.jquery.com: jQuery.each( collection, callback(indexInArray, valueOfElement) ) .each( f...

Best way to pass values to a function when there are many to send ?

What is the best way to define a method signature when you have to pass many values to a function and some of these may be optional. And in future, May be I have to pass more variables or subtract some passed values given to function. For example: (phone and address are optional) function addInfo( $name, $dob, $phone='', $address='' ) ...

Method signatures in classes which extend a generic class

If I have a generic class like this: public class Repository<T> { public string Greeting(T t) { return "Hi, I'm " + t.ToString(); } } which is extended like this: public class FooRepository : Repository<Foo> If FooRepository has a method called Greeting(Foo foo), does that method have the same signature as the base class ...

How does Java generate signatures for Methods?

Hey there! I have an Java class with a static final method getAll: public static final Vector<Category> getAll(Context context, ContentValues where) { ArrayList<Integer> IDs = null; if(where != null && where.containsKey(DatabaseAdapter.KEY_PRODUCT)) { IDs = OvertureItem.getAll(context, DatabaseAdapter.TABLE_PRODUCT_CAT...

How can I get the function sinatures from a jar file?

In Eclipse or NetBeans, when you "control + click" into a function, you can at least see its entire signature, even if it's in a jar file. I am wonderging if it's possible to write a tool to pull out all the function signatures from a jar file. Is there any API for this? I know jDepend seems to offer functions for this. However, I beli...

Python magical main() signature like Perl 6

Does python have any way to easily and quickly make CLI utilities without lots of argument parsing boilerplate? In perl6, the signature for the MAIN sub automagically parses command line arguments. Is there any way to do something similar in python without lots of boilerplate? If there is not, what would be the best way to do it? I'm t...

How can I make perltidy work with Method::Signatures?

I'm using Eclipse combined with EPIC to write my Perl code. I configured EPIC to use Perltidy with "-pbp" (perl best practices style) to format my code. This doesn't work well when using Method::Signatures' named parameters. E.g., func (:$arg1, : $arg2) is formatted as func (: $arg1, : $arg2) which yields an error. Also, func keyword i...

What's are options for simplifying calls to functions with the same name, but different signatures in separate subclasses in python?

I have an base class, and two subclasses. Each needs to implement a method that's defined in the base class (but in the base class raises an NotImplementedError.. the base class is basically an abstract class). But, the implementation of the method in one of the subclasses requires more parameters than in the other subclass. class Subc...

Interface implementation with method argument superclasses

As a practical example of the general question in the subject, I'd like to implement the containsAll method in the Set interface with public boolean containsAll(Iterable<?> c) { /* ... */ } I figure this should be allowed, since Collection is Iterable meaning such a containsAll would cover the interface requirement. Likewise, more ge...

Error CS1001 (Identifier expected)

Hello, I'm new to programming and am taking a C# class. I am getting compiler error CS1001 when I try to write this program. I read the Compiler Error description (link below), but I'm really not getting it. What am I doing wrong? http://msdn.microsoft.com/en-us/library/b839hwk4.aspx Here is my source code: using System; public cla...