So you've got an interface and an abstract class that implements a subset of the methods in the interface. You've also got some classes that inherit the abstract class and give implementations of the methods the abstract class doesn't give.
So what's the best practice here? I'm talking about issues like:
1) Should the abstract class im...
Hi everyone,
I am just curious how facebook for iPhone application can display a list of icons with the text, then all the icons shake to allow user to change the position of each item.
What kind of control is that, and is there some sample code that do the same thing?
I think it must be standard because it exists as well in home scre...
I am looking for a simple way to visualize some of my data in numpy, and I discovered the mlabwrap package which looks really promising. I am trying to create a simple plot with the ability to be updated as the data changes.
Here is the matlab code that I am trying to duplicate
>> h = plot([1,2,3], [1,2,3], '-o');
>> set(h, 'XData', [...
Hi,
I have a couple of classes all of them deriving from IQueryResult. I need each of those classes to be iterable in foreach loop. Unfortunately foreach loop cannot see GetEnumerator method. I've managed to use it in foreach using dynamic keyword available in .NET 4.0 but then IQueryResult need not to derive from IEnumerable.
public ...
I've already checked this.. similar question but I am not convinced about the answers...
I currently have an interface that is only being implemented by one class, but that is going to change sooner or later. I currently have a test against the interface, and all tests at the beginning start with:
IFoo foo = GetConcreteFoo()
where Ge...
Hey, I wonder how all this is in VB.NET
In C#
UserSettings vUsers = new UserSettings();
UserSettings.IUserSettings vUserI = (UserSettings.IUserSettings)vUsers
I took a chance to try to write it in VB.NET, but is this right?
In VB.NET
Dim vUsers As UserSettings = New UserSettings()
Dim vUserI As UserSettings.IUserSettings = (UserS...
We have an interface that is passed to the constructor using an IoC container
We have multiple classes that implement this interface.
The problem is, some (not all) of the implementations need to be cleaned up, preferably using the IDisposable interface.
Since not all of the implementations will need the "Dispose" method, do I includ...
I'm trying to write a scripting engine to my C#/XNA game using IronPython and came across a problem.
public class Game1 : Game, IGFXEnabledGame
{
//stuff
}
In the Game1 constructor I do necessary initialization for script and then run it to create the Camera object. I try to move the following hard-coded Camera initialization to ...
I've been spoiled using Java in the last few months! I have a C++ project where I would like to decouple a class interface (.h file) from its implementation details. But the class's member fields have to be in its declaration, and it seems like I have this unavoidable dependency linking if I want to tweak the class's member fields.
I kn...
As I read in Thinking in java,
Interface and inner class provide more
sophisiticated ways to organize and
control the objects in your
system. C++, for example, does not
contain such mechanisms, although the
clever programmer may simulate them.
Is it true that C++ programmer simluate features that java owns,e.g. interface ...
I have two questions regarding interfaces in Java.
1) If a class happens to implement all the interface methods of interface I, without declaring itself as implementing them, can it still be used as input into variables of type I?
2) Does a subclass of class A which implements interface I inherits the conformance to that interface, or s...
If I have a interface IUser and a class that implements IUser:
public class User : IUSer
and both files are in different folders, can't ReSharper figure this out and link the two if I need to push down a method to the interface and vice versa?
...
I am in the process of converting all my parameters, return types, classes to all use Interfaces instead ie. IUser instead of User.
Besides the extra code required to maintain this, are their any negatives to this approach?
...
I have a MethodInfo object that represents an explicitly-implemented interface method, as follows.
MethodInfo GetMethod()
{
return typeof(List<>).GetMethod(
"System.Collections.IEnumerable.GetEnumerator",
BindingFlags.Instance | BindingFlags.NonPublic);
}
How do I query this MethodInfo object to obtain the interfac...
I have an interface(call it as IMessage) which has a method Check(), a class implements this interface
interface IMessage
{
bool Check();
}
class NewClass : IMessage
{
#region IMessage Members
public bool Check()
{
//Some logic
}
}
That all fine. The problem is that I don't want this method(Check()) to be...
Hi guys.
I've received a native COM ADOConnection which is stored in Variant. I would like to pass interface of this connection to the VCL wrapper TADOConnection. The problem is that either I am getting invalid typecast compiler message or acces violation.
For example:
procedure AssignNativeConnection(VCLConnection: TADOConnection; va...
Hi folks,
On my company system, we use a class to represent beans. It is just a holder of information using boost::variant and some serialization/deserialization stuff. It works well, but we have a problem: it is not over an interface, and since we use modularization through dlls, building an interface for it is getting very complicated...
I am working on a .NET project, which needs to interact with some user defined classes - reffered to as "jobs". All job classes must implement a specific interface IJob in order order for the library to consume them. Sometimes a job class might hold unmanaged resource, which needs to be explicitly disposed.
How should I ensure that all ...
Know this has been asked before, however my question is slightly different.
I have an interface:
IEmailDispatcher
It looks like this:
public interface IEmailDispatcher
{
void SendEmail(string[] to, string fromName, string fromAddress, string subject, string body, bool bodyIsHTML, Dictionary<string, byte[]> Attachments);
}
As a ...
I have an application in VB/C# .NET which needs to interact with a third party API, but I would like to interface it out so I can use a mock API for testing purposes. Here are example API calls I would use in code:
RelayClient.AuthenticateUser(username, password, request, sessionID)
RelayClient.GetUserInfo(sessionID)
A few problems I ...