interface

Inserting records to an interface

I have set up a stored procedure for inserting a single record into a table. The reason for this is to create a general interface for people to use so I can change the table structure that it points to without anyone noticing or having to change code on their end in the future. The problem occurs when the user has to insert many records...

DRYing out C# for WPF windows with the same fields

I have two windows in my WPF app: a login window and an options window. Both have the same form with a user name and password field, as well as some other fields for providing credentials. I want some code that knows there will be a txt_userName TextBox available, for example, and can do things based on that. I was thinking I could m...

C++ Templates and Subclasses?

So, I'm learning C++, and I've run into something which I know how to do in Java, but not in C++ :). I have a template for a container object, which is defined as such: template <class T> class Container { vector<T> contained; public: void add(T givenObject) { this->contained.push_back(givenObject); } T g...

What is a proper way to write and implement a node/tree interface?

I am trying to write and implement a simple node/tree interface in PHP. Something along these lines: interface node { public function setParent(node $node); // can be null public function removeChild(node $node); // should not be null public function addChild(node $node); // should not be null } The implementation details...

Interfaces vs Inheretance: Which is better in this case?

Let's suppose I have a widget class: struct Widget { public Color Color { get; set; } public int Frobbles { get; set; } } Now, I need to make a factory to create these widgets, so I build a WidgetFactory: abstract class WidgetFactory { public virtual Widget GetWidget(); } As it turns out, you can make widgets out of sev...

How can i choose Abstract class or Interface..?

Possible Duplicates: Interface vs Base class Abstract classes vs Interfaces How can we take decision about when we have to use Interface and when Abstract Class..?? Any idea..?? Thank in advance! ...

Java compile error with interfaces

I get the following error message (reduced to the important part) when I'm compiling my classes: reference to keySet is ambiguous, both method keySet() in java.util.SortedMap<E,capture#614 of ?> and method keySet() in test.ImmutableMap<E,capture#614 of ?> match return map.keySet().iterator(); ^ map is of type Immutab...

Interface/Inheritance/Delegate design issue

I have a set of messages, that all derive from Message, and implement the interface IMessage: class Message : IMessage { public string example1; } class LogOnMessage : Message { public string password; } class LogOffMessage : Message { public string anotherExample; } I have a messaging system, in which a proxy is able to de...

C# LINQ/Object Initializers Example from C# 4.0 in a Nutshell

I'm not sure I quite understand how the following example works. It's from C# 4.0 in a Nutshell. class Program { static void Main(string[] args) { string[] names = { "Tom", "Dick", "Harry", "Mary", "Jay" }; IEnumerable<TempProjectionItem> temp = from n in names select new TempProjectionIt...

How do I initialize a view to an interface orientation?

The problem is that I am launching in-app email and triggering keyboards (via UITextFields) and they are coming up portrait on my landscape app. I am able to rotate it portrait, then rotate it landscape again, observing the black rotation corners animation that occurs when an app rotates from portrait to landscape. Since I've locked ou...

Visual Studio: Collecting the members of an interface in the same region

I find it useful to right-click on an interface, and click "Implement Interface." This will create any missing interface members in a new region. However, if your interface has recently changed (ie some of the members already exist, some do not) the members will not be placed together in the same region. Is there an easy way to collect ...

question in designing a class in java

I have a Employee class and department class.Now within employee i have a department as its member.The department can be either of 2 type "HR" or "Admin".Now should i declare departmentype as a enum in a separate interface and then should model department class as show below? public interface Myconstants{ enum Depttype{HR,Admin}; } ...

What is the purpose of hiding (using the "new" modifier) an interface method declaration ?

Hello, it's possible to mark a method declaration in an interface as "new" but does it have any "technical" sense or is it just a way to explicitly state that the declaration cannot override a previous one ? For example : interface II1 { new void F(); } interface II2 : II1 { new void F(); } is valid (the C# 4.0 compiler doe...

In C++, how can you avoid explicit downcasts with a map of generic types?

Hey all, This is a little contrived, but say I have a class interface like this: class IResource; class IResourceContainer { public: virtual ~IResourceContainer() {} virtual void AddResource(const std::string& rStrName, std::auto_ptr<IResource> apResource)=0; virtual IResource& GetResource(con...

Delphi: How delegate interface implementation to child object?

i have an object which delegates implementation of a particularly complex interface to a child object. This is exactly i think is the job of TAggregatedObject. The "child" object maintains a weak reference to its "controller", and all QueryInterface requests are passed back to the parent. This maintains the rule that IUnknown is always...

using interface builder to configure and instantiate UI objects (but not display them in view)

Hello, I'm working on my first iOS app. I haven't had a problem using interface builder in the standard way. I want to use interface builder to configure and instantiate a button, but not add it to a view (because I want to add the button to a navigation bar, which is created in a different nib). I tried to simply add the button (a seg...

class derivation problem

I have the following 3 classes: class Node { public Node Parent; // Edit: to clarify, each of these classes has many fields and methods public void Method1() { /*...*/ } public void Method2() { /*...*/ } /* ... */ public void Method30() { /*...*/ } } class Element : Node { public Dictionary<string, string> Attri...

Java Interface Query

If we execute run the following code, the output is 10. interface X{ int abc = 0; } interface XX extends X{ int abc = 10; } class XTest implements XX { public static void main(String[] args) { System.out.println("Hello World! --> " +abc); } } But as per Java, interface variables are public static final. but how am I gettin...

How do I edit iPad-specific XIB after upgrading project to Universal

I have an app project that I upgraded to a Universal App for the iPad. XCode created a Resources-iPad folder and duplicated my .xib file in there with the -iPad tacked onto the file name. That's all well and good. But when I edit that XIB it doesn't seem to understand this is an iPad XIB. For instance, the Window object is 320x480 an...

How to extract generic types from an assembly?

I have a peculiar problem here. I want to extract some generic types, which implements a generic interface from an assembly. I can accumulate all the types from the assembly but can not search for a particular implemented type from that type collection. Here are my code I am using, can you please point out what is the wrong with it? Or h...