I have a class that have a different Add method than the other classes and therefor cant implement the same interface... Should I split the current interface so it can use it too or should I just create another interface for it?
UPDATE:
public interface IProductRepository<T, T2>
where T : class
where T2 : class
{
void Add(T...
Let's say I'm writing an interface for a class A that keeps a list of objects of type B, and I want to be able to manipulate that list through class A's interface. I could put add_B, remove_B, etc. methods to A's interface, but that's a lot of code duplication (this situation occurs in many classes in my programme), so I'd rather return...
I've been slowly teaching myself the fundamentals of interface driven programming and I'm struggling to get my head round a few principles regarding inversion of control specifically with Ninject.
Lets say I have a concrete model class as follows...
public sealed class Host : EntityAuditable<Host, Guid>
I have a base class which def...
This may seem like an obvious answer, but I can't seem to find an answer. I have this code in VB.NET:
Public Interface ITestInterface
WriteOnly Property Encryption() As Boolean
End Interface
And I also have this class and implementation in VB.NET:
Partial Public Class TestClass
Implements ITestInterface
Public WriteOnly...
Hi, why cannot I declare an abstract method within an interface? This is my code. Thank you.
<?php
interface Connection {
public abstract function connect();
public function getConnection();
}
abstract class ConnectionAbstract implements Connection() {
private $connection;
public abstract function connect();
publi...
UPDATED: Added some sample code to help clarify.
Hi, Feel like this shouldn't be that complicated, but I think I just don't know the proper name for what I'm trying to do. I'm dealing with an ASP.net project.
The concept is pretty simple:
I have a library that supplies some ecomm functions.
One class in the libary contains functions a...
Hi people. I am a physicist. I am trying to work on Delphi with an imported activex control (ocx file). Let’s say there are 3 automation interfaces in the library: IGraph, IGraphAxes and IAxis. The structure of the library is such that:
===IGraph’s properties:===
Idispatch* IGraphAxes;
... //other members
===IGraphAxes’ properties:===
...
This is related to final interface in java. Among the discussion there was that the concept of final in relation to interfaces is ambiguous. Would a final interface mean that it can not have subinterfaces? Would it mean that it can not have implementations?
This question is the first: can you write an final interface such that the co...
Consider this example
The Interface
interface IBusinessRules
{
string Perform();
}
The Inheritors
class Client1BusinessRules: IBusinessRules
{
public string Perform()
{
return "Business rule for Client 1 Performed";
}
}
class Client2BusinessRules: IBusinessRules
{
public string Perform()
{
re...
Hi
I have a question regarding Interface. There are 2 interface both contain the same Method Test().
Now I'm inheriting both the interface in Sample class.I want to konw wjhic Interface's method will be called?
My code sample is below:
interface IA
{
void Test();
}
interface IB
{
void Test();
}
class Sample: IA, IB
{
publi...
Is there a way to explore a interface's properties with Rtti?
The following code does not work:
procedure ExploreProps;
var
Ctx: TRttiContext;
RttiType: TRttiType;
RttiProp: TRttiProp;
begin
RttiType := Ctx.GetType(TypeInfo(IMyInterface));
for RttiProp in RttiType.GetProperties do
Writeln(RttiProp.ToString);
end;
Has an...
I'm look for good alternatives to invoking a specific interface from a generic framework. I'll exemplify with code. Look to the question part, the example code is primarily included for thoroughness, and for putting the example into a real scenario.
Example
Assume we want to build a report based on a list of components. Say we have tw...
Hey, I'd like to know if what I'm trying to do is even possible? Comments in code should give and idea what I'm trying to achive :)
interface ITest<T> {
T t { get; }
bool DoTest();
}
public abstract class Test<T> : ITest<T> {
public Test (T nt) {
this.t = nt;
}
public Test () {
}
public T t {
...
Newbie in c#
there are many framework interfaces like iDisposable, Iqueryable,IEnumerable available which have different uses
Is there a list available for such system interfaces which can be used as ready reference
...
I'm currently working on a WPF/C# application which is connected to an external camera. This application gets a snapshot from the camera, then does some analysis and displays it to the screen via a user interface. There are also many other UI elements on the interface (such as buttons, menus, and comboboxes). Right now, while the appl...
Possible Duplicate:
Interface vs Abstract Class (general OO)
Can I ever instantiate an Abstract class? If so, why would I not make all my non-sealed classes abstract?
If I can't instantiate it, then what is the difference from an interface? Can the abstract class have "base" class functionality? Is there more to the differ...
We have a win32 unmanaged application that has an API we distribute as a type library. Several other applications we build depend on the TLB from the legacy application being registered to build.
Each product is still under active development, including the items exposed/accessible to the type library. While trying to find the best ...
I have an command line interpreter (or "line-oriented command interpreter" in the python docs for the cmd module) for a program that I'd like to add command line utility interface to. For example, now a session looks like this: (% for shell prompt, :) is my custom prompt)
% tasks (invokes command line interpreter)
:) clockHours Teachin...
I'm trying to use the XmlSerializer to persist a List(T) where T is an interface. The serializer deos not like interfaces. I'm curious if there is a simple way to serialize a list of hetrogenous objects easily with XmlSerializer. Here's what I'm going for:
public interface IAnimal
{
int Age();
}
public class ...
Hi I have a very simple class that implements an interface. Both the class and the interface are in the same file.
When I implement the interface I get a fatal error "Class not found", but when I remove the implements and then try to use the class I can use it fine???
Can anyone offer any advice on this?
Sorry here is some code that ...