interface

how to add delegate to interface c#

I need to have some delegates in my class. I'd like to use the interface to "remind" me to set these delegates. How to? my class look like this public class ClsPictures : myInterface { // Implementing the IProcess interface public event UpdateStatusEventHandler UpdateStatusText; public delegate void UpdateStatusEve...

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...

Issue with interfaces in Java

I'm working through an exercise sheet regarding interfaces, generics and abstract classes in Java. No matter what way I seem to code it, the class Exercise1 won't work. The question asked are commented in the code. Any help would be appreciated, I'm not sure if the error is in the Exercise one code or the implementation of the interface ...

Is correct use Interfaces this way, is there a better option?

Hey guys, It's 5 am here, I was doing some code... when this came out: public interface IViewModel { } public interface IToViewModel<T> where T : IViewModel { } public static class MvcExtensions { public static T ToViewModel<T>(this IToViewModel<T> self) where T : IViewModel { var instance = Activator.CreateIns...

Excel RTD COM server - Cannot cast UpdateEvent (class) to IRTDUpdateEvent (interface)

Hello All This issue is related to a blog post by Kenny Kerr on "Excel RTD Servers: C# Interfaces", which can be found here, that should allow you to build an Excel RTD server without including a reference to any specific Excel type library; having to include a reference makes your RTD server Excel version specific (forwards compatible,...

implementing Comparable in an interface

I am calling a specific class using only its interface. The problem is, the class itself implements Comparable, but because I am referring to the class via a different interface, the compiler does not know it implements Comparable. I'm sure there is an easy solution to this... but I just can't think of it right now. ...

concept of inheritance in java

hi i am new to java....moved from objective c (iphone background) all we know that here we cannot use multiple inheritance.... alternative way is interface...... my question is...... does inheritance through interfaces make any sense...because we have to define the code of function in our class.......only helping part here is variabl...

C# Interface implementation: doing the right thing

Hi guys! I've got a hypothetical Reseller who can supply some Services; all Services are same: they threat some IRequest data, plus some IExtraData, and provide an IResponse. Please read this code (working on C# 2.0): public interface IResellerService<in TIn, in TInExtra, out TOut, in TOutExtra> where TIn : IRequest where ...

Is there any new interface that has been introduce with dotnet framework 4.0?

Curious to know if any has been because googling didnot helped much. Thanks ...

Overriding a method contract in an extended interface that uses generics (Java)?

I am attempting to override a method declaration within an interface that extends another interface. Both of these interfaces use generics. According to the Java tutorials, this should be possible, but the example does not use generics. When I try to implement it, the compiler shows the following error (I've replaced names because some o...

What does <> mean when defining an interface

I learning about writing my own interfaces and came across this msdn article. Everything seems fine, except I cannot find anywhere what the < T > means or does. Can anyone help me out? interface IEquatable<T> { bool Equals(T obj); } ...

Delphi Interface Performance Issue

I have done some really serious refactoring of my text editor. Now there is much less code, and it is much easier to extend the component. I made rather heavy use of OO design, such as abstract classes and interfaces. However, I have noticed a few losses when it comes to performance. The issue is about reading a very large array of recor...

Implement enum in c# Interface and in one of interface's method signature

I have an interface Interface: interface IThing { Enum MyEnum {get;set;} string DoAction(MyEnum enumOptionChosen, string valueToPassIn); } Concrete implementation: public class Thing : IThing { public enum MyEnum { FirstOption, SecondOption, ThirdOption } string doAction(MyEnum enumOptionChosen, string value...

Difference between @interface definition in .h and .m file

Hi friends... Normally we use @interface interface_name : parent_class <delegates> { ...... } @end method in .h file and in .m file we synthesis the properties of variables declared in .h file. But in some code, this @interface.....@end method is kept in the .m file also. What it means? What is the difference between them? Also g...

Interface-based programming in C++ in combination with iterators. How too keep this simple?

In my developments I am slowly moving from an object-oriented approach to interface-based-programming approach. More precisely: in the past I was already satisfied if I could group logic in a class now I tend to put more logic behind an interface and let a factory create the implementation A simple example clarifies this. In the pa...

The point of an Interface

Possible Duplicate: How will I know when to create an interface? I'm wondering about the point of using an Interface. Do you use Interfaces? If so, when do you decide to use them and when do you decide NOT to use them? I've currently got interfaces defined for my service layers and my repository layers, but I'm wondering i...

Height and width on iPhone (/iPad)

This is just a test application, There is only a AppDelegate class to create all I did was create a Window based app, set the supported orientations to only the landscape in the info.plist, and then add the following code: - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { ...

How i can attach touch event to Uiwindow or UIview

I want simple flip pages on iphone ...

Interface implmentation with empty body

I have a use case of this kind interface i { void method1(); void method2(); } class A implements i { void method1() { System.out.println("Method1 A .."); } void method2() { System.out.println("Method2 A .."); } } class B implements i { void method1() { System.out.println("Method1 B .."); } //Ass...

Is there a way to store "extensible enums" in an EnumMap?

I'm referring to the paradigm in Item 34 in Effective Java by Joshua Bloch.  I would like to take the method he's using which is to have each related enum implement a base interface, and initialize an EnumMap from the "sub-enums." See the code section below.  I'm getting a syntax error which I don't understand.  I'm not set on this meth...