interface

C# - What should I use, an Interface, Abstract class, or Both?

So, hypothetically, I'm building some sort of real estate application in C#. For each type of property, I'm going to create a class such as ResidentialProperty and CommercialProperty. These two classes as well as all other property classes will share some common properties, such as Id, Title, Description, and Address information. What I...

How to use Maven to handle a cross-platform (Windows + Linux) Java Native Interface Project?

I am currently trying to develop a cross-platform solution that will make some UI components that are not already part of the java standard library available to my java code. I am writing xlib code for X11 and using the relevant win32 api's for windows. Is it possible (or even recommended?) to setup a java and c code build system using ...

Enumerate all Delphi classes that implement a given interface?

With the new extended RTTI in Delphi 2010, can a Delphi application (at run time) build a list of all classes which implement a given interface? ...

Why don't all Java classes have interfaces?

I got this question for homework, and I'm not sure how to answer it. Could you help me out? :) ...

implementing interface in an aspx page

for reasons beyond the scope of this discussion (say xcopy an aspx page to a directory, so that we dont have to get a new build out) , we would like to implement an interface in an aspx page.Say, if the page is myPage.aspx, it is usually your class in the codebehind mypage.aspx.cs which implements the interface. When I do something like...

Significance of Interfaces C#

Hi All, I would like to know the significant use of Interface. I have read many articles but not getting clearly the concept of interface. I have written a small program. I have defined the Interface Itest.Class(Manager) has implemented the Interface.Another class(Employee) has not implemented interface. But defined the same method(DoS...

C# generic interface specialization

I wonder if it is in any way possible to specialize generic interface methods somehow in C#? I have found similar questions, but nothing exactly like this. Now I suspect that the answer is "No, you can't" but I would like to have it confirmed. What I have is something like the following. public interface IStorage { void Store<T>(T ...

java interface extends comparable

Hi all, I want to have an interface A parameterised by T A<T>, and also want every class that implements it to also implement Comparable (with T and its subtypes). It would seem natural to write interface A<T> extends Comparable<? extends T>, but that doesn't work. how should I do it then? ...

Why classes compile to .class but interface does not to .interface

Is there any specific reason why interfaces are not compiled into MyInterface.java compiled into .interface file?But any class is compiled into .class file.! ...

How to set a object to an interface in Objective-C?

Hi, I want to know how to create an object to an interface ie @protocol in Objective-C? ...

Using Java generics in interfaces that return collections. Best practice? Pitfalls?

I ran into some code today that I found questionable. Here's a simplified example (not realistic). public interface IListable { //returns first n items from list public ArrayList getFirstNThings(int n); //returns last n items from list public ArrayList getLastNThings(int n); } Then there's an implementor like so: pu...

When should I make a referencing outlet for a UI control and when just an event? (iPhone SDK)

I have some code that works without having referencing outlets for the controls - just event ties in Interface Builder. Is this ok and is a referencing outlet only necessary to change the state of a UI control? Thanks. ...

@protocol implementation in @interface in Objective-C

Hello, I need to develop an application which has a interface which implements methods of 3 protocols. Assume protocol A extends protocol B and protocol C, and interface implements protocol A. This is how my code looks, // This is in MyClass.h file #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "protocol_A" @interfac...

How to assign object of one class to other in Objective-C?

Hello, how to assign object of interface to a protocol's object? i've a protocolA and protocolB. all the methods of both the protocols is implemented in MyClass.How to restrict the access to only protocolA's methid and protocolB's methods ?Coding is done in Objective-C for iPhone application. ...

Why does overriding a method only occur after I implement an interface?

I've been reading through the book Working Effectively with Legacy Code and I've been playing around with the concept of overriding difficult to test methods in unit tests via the creation of a fake. I put together an example of what I thought would work and it ended up behaving differently than I had been expecting. I think I've just di...

How can i asure safety when i execute a method of a .class file?

I know the interface of the .class file lets say Boolean xy(); is the only method. I want to execute the method of an unknown .class file which implements that interface on my server. The Method should be able to call some Methods of my classes. How can i be assured or test that no dangerous stuff is executed in the method? ...

Java Comparable Interface

I was wondering why the sort method of the Arrays class is asking for a parameter of type Object[]. Why the parameter is not of type Comparable[]. If you don't pass a Comparable[] it's generating a ClassCastException. Why ... public static void sort(Object[] a) and not public static void sort(Comparable[] a) ? Thanks ...

PHP: Can I Use Fields In Interfaces?

In PHP, can I specify an interface to have fields, or are PHP interfaces limited to functions? <?php interface IFoo { public $field; public function DoSomething(); public function DoSomethingElse(); } ?> If not, I realize I can expose a getter as a function in the interface: public GetField(); ...

SubSonic, SimpleRepository and entity interfaces

Hi, Firstly, I want to apologize for my English, not my strongest side. To the question. In my current project, I have interfaces to my entities so I can use Subsonic attributes at my head entites and I want to be able to seamlessly switch O/R mapper in the future. Anyway, I get an error when I try to use my interfaces and SimpleReposit...

How can I make a UIView glossy and shiny?

I'm coding an iPhone app annd I currently have a View that looks like this: I'm wondering if there is a way to make it shiny and glossy like the Phone.app call screen. Thanks! ...