Is it considered good practice or bad practice to write an interface that exists solely to concentrate other interfaces?
interface InterfaceA : InterfaceB, InterfaceC {
}
In doing this, a concrete implementation only needs to implement InterfaceA, which seems like a good thing, but it doesn't add any value by extending, which seems wa...
I want to declare a variable which holds a class which implements a specific interface. Specifically, I'm trying to store a SocketChannel and a DatagramChannel in the same property so I can use them interchangeably. Both of these classes extend SelectableChannel and also implement ByteChannel, and I wish to call methods from both. I d...
I just looked up the Set interface and found that it mostly (or completely) only redeclares functions which are already in the Collection interface. Set itself extends Collection, so doesn't that mean that the Set interface automatically has all the functions from Collection? So why are they redeclared then?
For example, Set redeclares ...
Hi guys
I'm being overly simplistic here, but say I have a WinForm with several controls on it (for example: a textbox, a treeview and a listview).
To ensure the smoothest possible experience for the future (for instance, that listview may one day hold a lot of data), what should be done at the start?
My knowledge of this kind of thin...
I have some code to implement interface in C#
public interface Intfc { void xyz();}
public class BaseClass : Intfc
{
public virtual void xyz()
{
Console.WriteLine("In Base Class");
}
}
public class Derived : BaseClass
{
public override void xyz()
{
Console.WriteLine("In Derived Class");
}
}
st...
Why is this acceptable:
type SomeClass<'T> =
val mutable id : int
val mutable result : 'T
But this is not:
type SomeIface =
abstract id : int
type SomeClass<'T> =
interface SomeIface with
val mutable id : int
val mutable result : 'T
The compiler complains about my use of 'val' telling me to use 'm...
Hello All,
Firstly, this is just an Object Oriented Programming question and does not apply to any Language in particular.
This is quite embarassing for me. This incident happened @ work and I was too shy to clarify this with my colleagues as it would indicate a poor understanding of Object Oriented Programming on my part. So here is t...
I often encounter in articles which describe abstract class and interface, that C# does not support multiple inheritance but can be achieved using interfaces. I don't agree to that for the following reasons
We always inherit the state and behavior from any class.
Interface does not define the state or behavior.
We cannot inherit anythi...
Hello,
i'm trying to switch out .hbm mappings to fluent mappings an have a problem with the mapping of composite-ids and the usage of Interfaces
the Class looks at follows:
public class ClassWithCompositeId {
public virtual IKeyOne KeyOne { get; set; }
public virtual IKeyTwo KeyTwo { get; set; }
}
our hbm mapping looks like this...
I started with this:
interface IFoo
{
string X { get; set; }
}
class C : IFoo
{
public void F()
{
}
string IFoo.X { get; set; }
}
It compiled as I was expecting. No surprise.
Then I go to this:
interface IFoo
{
string X { get; set; }
}
class C : IFoo
{
public void F()
{
X = "";
}
st...
I am still experimenting with how Java handles generics. I stumbled upon the fact/issue/thing that if you have a generic interface like A<T>, you cannot really check afterwards if some object is actually implementing A<B> or A<C>.
I wondered if that could cause actual problems.
Now I have tried this code:
static interface A<T> { void ...
I'm trying to get the hang of clojure in a selenium2/webdriver project using the webdriver-clj wrapper for webdriver.
However, since the webinterface is heavily scripted, I need to have an option to wait until certain elements are created by the script, instead of on page load.
So I was trying to create a wait-for function in clojure, ...
How to declare explicit a member of a interface?.i.e:
public interface IPerfil
{
int IDPerfil
{
get;
set;
}
int IDMarca
{
get;
set;
}
int IDRegional
{
get;
set;
}
int IDFilial
...
interface TestA { String toString(); }
public class Test {
public static void main(String[] args)
{
System.out.println(new TestA() { public String toString() { return “test”; }});
}
}
What is the result?
A. test
B. null
C. An exception is thrown at runtime .
D. Compilation fails because of an error in line 1.
E. Co...
My project is using an Interface to connect some optional code to my main application. It builds and runs fine during development but when I build it on my build machine I get Errors like the one below.
ERROR BC30456 in C:\calc{list} Build{Pro}\Trunk\plugin Constant Contact\InfusionLogic.CC\calcListCCListColSWB.vb(94,0) : 'IconCol' is ...
One more question, what is the difference between abstract class and interface?
Thanks for your help
...
Suppose I have a function
void foo(char *)
which, internally, needs to treat its input as a block of NUL-terminated bytes (say, it's a hash function on strings). I could cast the argument to unsigned char* in the function. I could also change the declaration to
void foo(unsigned char *)
Now, given that char, signed char and unsigne...
Hi! I'm trying to define interface in which one method (initPage) needs to have different arguments in every implementation. How can I do this? Using ...args for me is not good, because I'm loosing strong type checking.
public interface IPage {
function initPage(...args):void;
function showPage():void;
function hidePage():vo...
I tried using the following query:
Query q = getPersistenceManager().newQuery(
getPersistenceManager().getExtent(ICommentItem.class, false)
);
but got:
org.datanucleus.exceptions.NoPersistenceInformationException: The class
"com.sampleapp.data.dataobjects.ICommentItem" is required to be persistable yet no Meta -Data/Annotations c...
Hi,
I am new to java, hence again another probably silly doubt.
I just want to know whether I can create public static final variables in an interface file. I know interfaces are abstract classes which contain methods that must be implemented by any class which implements the interfcae. But my question is whether I can keep some common...