interface

extending a class and implementing an interface

I am creating objects for a game, they are all sprites. but I also want them to implement an interface. Is it possible to do both ? If not, how can i have an object have the capabilities of a sprite and also have it implement an interface. I am wanting to create another class that checks all my objects to see what datatype they are and e...

How to properly create Game Objects

I am making sims like game and right now I am trying to figure out how I will structure my objects. Right now I am thinking to create a class called GameObject, the psuedo is below public class GameObject { name:String width:int height:int } This way I could create objects like bushes, trees, and buildings. But...

Does a class have to implement a interface directly

Quick question. Does a class have to implement a interface directly to be accepted, or can it be a child of a parent class that implements it. so If I pass a child object into a method that only accepts IOBJECT, but the child class parent implements IOBJECT. will child object be accepted ? ...

Finding out what type a certain interface is

I am creating a method that accepts a IOBJECT parameter. there is multiple class that implement this interface. I need to figure out which type IOBJECT is. how would i go about doing that ...

applying the is operand or the instanceof in a case statement

I am trying to figure out how to apply the is operand or the instanceof in a case statement to determine which datatype a interface object belongs too. keep getting errors switch (IOjbect is) { case Tile: trace ("Load Tile"); break; case House: trace ("A House Load...

How do interfaces work and How to use them in practical programming

I started my programming life not long ago. It is said that if you combine data and algorithm together, then you got a program. That is exactly what I do now, yet I hear these theories: Build for today, design for tomorrow Before coding, make each module as clear as possible Your code should not be understandable by just a handful o...

Multiple inheritance using interface C#.

I am trying to use selective features of two classes into 3rd class. For example, I have Button1 class which creates a fancy button border and Button2 class which writes a the text in colorful format. Now these classes are provided to me by 3rd party vendors where i dont have access to the code. The classes are not sealed so i can inheri...

Interaction between Java App and Python App

Hi, I have a python application which I cant edit its a black box from my point of view. The python application knows how to process text and return processed text. I have another application written in Java which knows how to collect non processed texts. Current state, the python app works in batch mode every x minutes. I want to make...

Minimal API v. Convenience

I am trying to design the interface that will be used internally for my application. Following Google's example, I strive to reduce public API clutter. However, there are some convenience methods that are defined in terms of the minimal methods. What factors should I consider as I seek a balance between convenience and tidiness? Google ...

Can we have a "not override a concrete method ..." compile time error when implementing interfaces ?

Can we have a "not override a concrete method ..." compile time error when implementing interfaces ? An example to be more clear : I build up a framework containing interfaces. To use the framework developers need to implements some interfaces. But if they don't override equals(Object object) and hashCode() Object methods the internal ...

abstracting code from two methods in Java, maybe use delegates?

I have two methods that do essentially the same thing, just with different types. I want to abstract out this functionality to some generic method and I think I could do it easily in C# with delegates, but I don't know the equivalent in Java. I'm just showing two of the methods here, but there are several (like eight) different makeWha...

Loose coupling : Can we use Interfaces when we need cloneables params ?

As I was advised by PMD, I want to reduce coopling by using interfaces instead of implementation ... In this case, knowing that I need a cloneable param, can I overcome the clone Dilemma (no clone() method in the Cloneable interface) ?? public MyConstructor(ArrayList<E> myParam) { this.myAttribute = (ArrayList<E>) myParam.clone(); ...

Objective C protocol as an equal to Java Interface?

Hi The question is not only regarding the headline, but more of a "how will I achieve this, without trying to force a Java/Flash design into an Objective C (iPhone)program". I have 6 views that extends UIView, these views all have different behavior but share certain methods, like -(void) update and -(void) changeState:(NSInteger)state...

C++: Composition Interface

So I've spent some time thinking about this and been all over google looking for a 'solution' (the solution is most likely a matter of preference, but I'm unsure about this). Below is the problem I have, but the problem can be applied to a lot of situations regarding composition. I have a class, Colour, containing the members of red, gr...

interface not implemented error when signing C# assembly

I've been trying to sign an assembly and getting this error: 'Utils.Connection' does not implement interface member 'Interfaces.IConnection.BugFactory()'. 'Utils.Connection.BugFactory()' cannot implement 'Interfaces.IConnection.BugFactory()' because it does not have the matching return type of 'ThirdPartyLibrary.BugFactory'. That e...

Inherit from a generic base class, apply a constraint, and implement an interface in C#.

This is a syntax question. I have a generic class which is inheriting from a generic base class and is applying a constraint to one of the type parameters. I also want the derived class to implement an interface. For the life of me, I cannot seem to figure out the correct syntax. This is what I have: DerivedFoo<T1,T2> : ParentFoo<T1, T...

C# how can a delegate & interface method interchangable

Can I use interface method instead of delegate? How? I found searching that interface method is faster than using delegates. I would appreciate a simple code snippet. ...

Shortcut to create interface implementations in NetBeans

I'd like to have a shortcut to create an implementation of an interface. Example: right click on an interface file, choose "implement", insert class name. Is there something like this in NetBeans (6.8)? ...

.net Interface explanation

I understand that an interface in .Net defines a contract between the interface and a class that inherits it. Having just gotten done working on a project that made heavy use of an interface for the Data Access Layer, it got me thinking . . . whats the big deal? When I had to add a new method to the DAL, I had to create the method sign...

how to create records for writing a csv file with FileHelpers

I am using Filehelpers to import my database from files. I am now working on the reverse process and am having trouble seeing how to create the records from my data objects. All the examples I can find show going from file -> table -> file I am using interfaces with generics to convert. I use this one on the inbound conversion: publi...