interface

First iPhone App View Position Problem

I am closely following the instructions given in the tutorial "Your First iPhone Application" on apple ADC. In the interface builder, I have set up a button positioned on the top according to the Apple Interface Guidelines. It runs without trouble if I simulate the interface in IB. However, if I run the built app, I get what is shown he...

Type constraints on implementations of generic members of non-generic interfaces in C#

Let's say I have an interface like that: interface IAwesome { T DoSomething<T>(); } Is there any way to implement the DoSomething method with type constraint? Obviously, this won't work: class IncrediblyAwesome<T> : IAwesome where T : PonyFactoryFactoryFacade { public T DoSomething() { throw new NotImplementedExce...

C# : Mini Application Structural Design (Classes/Interfaces/etc.)

I've been creating a small application that allows a user to convert images to various sizes and formats. I've been struggling on getting a good solid design with this application. I have the application up and running, but it does integrate good Object-Oriented design. Since this is a personal project, I've been wanting to learn more...

Doubt in using the interface ?

Hello All, Whenever i hear about interfaces i have the following doubt. i have the following interface interface Imammals { walk(); eat(); run(); } and i have two classes Human and Cat that implements this interface. Anyway, the functionality of the methods are going to be diffe...

Delphi: Calling a function from a vc++ dll that exports a interface / class

Hello, i have some trouble accessing a dll written in vc++ that exports an interface. First i tried to use classes, but after some google-search i came to the solution, that this i not possible. I just want to make sure, that the plugin interface can accessed, by using other languages like c++. Delphi Interface IPlugIn = interface fu...

C# Language Design: explicit interface implementation of an event

Small question about C# language design :)) If I had an interface like this: interface IFoo { int Value { get; set; } } It's possible to explicitly implement such interface using C# 3.0 auto-implemented properties: sealed class Foo : IFoo { int IFoo.Value { get; set; } } But if I had an event in the interface: interface IFoo ...

Interface Inheritance: Method does not show up!

I've got an interface inheritance issue that has been vexing me for some time. It doesn't seem to make any sense, and I can only conclude that I'm missing something fundamental. Overview The code below is from part of a fluent interface for our ORM tool. It provides a SQL-like syntax for pulling data from the database. You don't have t...

How to convert a generic List<T> to an Inerface based List<T>

I am sure I am missing something simple, however I am trying to convert a strongly typed list of objects that all implement an interface in to a list of that interface type. Below is a sample to demonstrate the error: public void ExampleCode(){ List<Cube> cubes = new List<Cube>(); List<Shape> allShapes; allShapes = cubes;/...

Interfaces, Anonymous Methods and Memory Leaks

Hi, this is a constructed example. I don't want to post the original code here. I tried to extract the relevant parts though. I have an interface that manages a list of listeners. TListenerProc = reference to procedure (SomeInt : ISomeInterface); ISomeInterface = interface procedure AddListener (Proc : TListenerProc); end; No...

Is there a way to hide the methods partially in child classes?

This question seems weird, but i came across this question in one of the interviews recently. I ve been asked, is there a way in c# to hide the methods partially in a inherited child classes?. Assume the base class A, exposed 4 methods. Class B implements A and it will only have the access to first 2 methods and Class C implements A wi...

How to open the keyboard automatically on UITextField ?

Hi I have a very simple table and when tocuh a cell it opens a new view with one UITextfield. All I want is that the keyboard will automatically opens, without the user have to touch the UITextfield. Its all done in Interface Builder, so I am not sure how I do this. I guess I need to set the focus at some point ? Thanks ...

When to use an abstract class with no interface?

Whenever I create an abstract class I tend to create an interface to go along with it and have other code refer to the interface and not the abstract class. Usually when I don't create an interface to start with I regret it (such as having to override all implimented methods to stub the class for unit testing or later down the line new ...

Autosizing boxes and positioning in Cocoa

Hi, I'm creating an application, from which a part looks like this: I all dragged them to a window in IB, but the problem is that the NSImageView, Action Buttons (Suggest, Send, Poke etc...), Information NSBox, and Friends NSTabView can all vary in height. They should always be placed below each other, with a margin of 8px. Just like...

C# Generics - Find correct concrete class depending on object type

I have my domain model with several NewsType's which are subclasses of NewsItem as shown below (simplified): public abstract class NewsItem : Entity { public virtual Account Account { get; set; } public virtual DateTime DateTime { get; set; } } Here are a couple of subclasses of NewsItem: public class NewsItemJoiner : NewsIte...

Wrapping a pure virtual method with arguments using Boost::Python.

I'm currently trying to expose a c++ Interface (pure virtual class) to Python using Boost::Python. The c++ interface is: Agent.hpp #include "Tab.hpp" class Agent { virtual void start(const Tab& t) = 0; virtual void stop() = 0; }; And, by reading the "official" tutorial, I managed to write and build the next Python wrapper: A...

Type List vs type ArrayList in Java

(1) List<?> myList = new ArrayList<?>(); (2) ArrayList<?> myList = new ArrayList<?>(); I understand that with (1), implementations of the List interface can be swapped. It seems that (1) is typically used in an application regardless of need (myself I always use this). I am wondering if anyone uses (2)? Also, how often (and can I p...

Abstract vs. Interface - separating definition and implemention in Delphi

What is the better approach for separating definition and implementation, using interfaces or abstract classes? I actually I don't like mixing reference counted objects with other objects. I imagine that this can become a nightmare when maintaining large projects. But sometimes I would need to derive a class from 2 or more classes/in...

WCF Service Clients

Good day people. I have never posted on these type of sites before, however lets see how it goes. Today i started working with WCF for the first time, i watched a few screencasts on it and now i am ready to jump into my first solution implementing it. All is well and so far all is working, although my question comes when i create the WC...

Why can't I do this with interfaces?

I'm trying to do something like this, but Java won't let me. I suspect that I am just doing something wrong, but I really have no idea what. public interface PopulationMember extends Comparable<T extends PopulationMember> { int compareTo(T o); T merge(T o); // Some other stuff } It seems to think that T should be a class...

C# Interfaces- only implement an interface in other interfaces

I would like to only implement certain interfaces within other interfaces, I don't want them to be able to be inherited directly by a class. Thanks in advance! ...