I am just trying to understand why all fields defined in an Interface are implicitly static and final. The idea of keeping fields static makes sense to me as you can't have objects of an interface but why they are final (implicitly)?
Any one knows why Java designers went with making the fields in an interface static and final?
...
The question I have is this: If I have the MethodInfo object, for a method, obtained from an interface type, and I also have the Type object for a class that implements this interface, but it implements the said method with an explicit implementation, how do I correctly obtain the corresponding MethodInfo object for the implementing meth...
I'm about to undertake the task of abstracting out all SQLExceptions from an ORM's public interfaces with something more generic - that is declaring a generic exception which would in most cases wrap say an SQLException), and I'm wondering about naming.
I'm thinking of something along the lines of BackingStoreException or StorageMediumE...
This is a pretty basic OO question but I'm curious if I've been going overboard.
Let's assume the following hierarchy, which is an example along the lines of what I would typically create:
IVehicle
- IFlyable
- IPlane
- Plane
- IHelicopter
- Helicopter
- IDrivable
- ICar
- Car
-...
I want to force a class to define a certain variable from the class it implements. e.g.
class Fruit{
String name; // Cause each fruit has a name
}
//Apple wants to get an error if it does not use the name variable
class Apple implements Fruit {
String name = "Apple";
}
Is there a way to do that? Just like java.io.Serializab...
Is strict OOD/Interface-based design/Aspect oriented design is desirable in case of a software application development?
Or, is it desirable to mix all of them for the ease of coding?
Are all successful and highly maintainable software applications strictly Object oriented, or, strictly Interface oriented, or, strictly Aspect Oriented, ...
I have an interface, called IRepository.
One of the methods in this interface is:
IEnumerable<T> FindByQuery(Expression<Func<T, bool>> predicate);
I then have (for example) an IUserRepository, that implements IRepository.
In my implementation of IUserRepository, currently called LinqToSqlUserRepository, i have implemented the FindByQ...
I am bit unclear in using IUnknown interface .Is IUnknown interface only meant to work with COM /COM + Objects and some unmanaged codes like Win APIs ?
...
If I have an object with 50 getters/setters, where every 10 of them is defined under a new interface, and I type the object as one of those interfaces, will it increase performance?
Not sure how method/variable lookups work, but it seems that if you type the object to something that has fewer methods, it would be faster to run those met...
Hi all,
I am looking to implement an interface which has a function which will return the type of the base class without using a generic interface. Is this possible?
class MyClass : MyInterface<MyClass> // Would rather use one below
class MyClass : MyInterface // Functions already know to use MyClass
...
When I add a Facebook link to my website, it picks up randomly large images from the site, and not quite attached to the story. How can I control what images are picked up by Facebook?
...
I just have a simple Interface definition in my project, which I haven't even used yet. But when I try to build the project I get this error:
Access is denied: 'System.IEquatable`1[Reactor.IOptions]'.
Below is the interface:
Interface IOptions
Inherits Xml.Serialization.IXmlSerializable ' Optoins Should...
Intro
I am building a plugin architecture in my app. The plugins implement a given Interface IBasePlugin, or some other interface which inherited from the base interface:
interface IBasePlugin
interface IMainFormEvents : IBasePlugin
The host is loading the plugin assemblies, and then creates the appropriate object of any class implem...
Note: in this question, I am talking about formal Interfaces (e.g. public interface IButton {...} ).
I'm an Actionscript developer, but I suspect my question will resonate in many languages that allow both formal Interfaces and Events.
I love Interfaces. I love the separation between interface and implementation. (I wish Actionscript...
Let me describe the situation, and I'm sure I'm just thinking about this problem incorrectly. I have a concrete class that will implement an interface. I want to enforce in the contract that the class must have a constructor with a specific type. So for instance:
interface MyInterface {}
public class MyClass implements MyInterface {
...
The installer proposed me to choose more convinient view: like in Delphi or like in MS Office.
I chose Delphi, but now I want to change it. And I cant find how to do it. Is is possible?
...
I am writing a number of unit tests for a logger class I created and I want to simulate the file class. I can't find the interface that I need to use to create the MOQ... so how do you successfully MOQ a class without an interface?
It also isn't clear to me how I can use dependency injection without having an interface available:
priv...
Why are we implementing, for example ICloneable,IDisposable. Actually I am not asking what ICloneable or IDisposable do, but I want to learn what's a good reason to implement these interfaces rather than just writing a method which dispose or clone our objects ?
Thanks.
...
I've got a class which has properties referenced to couple of interfaces and classes.
Now I'm trying to transfer this one class via WCF (named pipes), what's the best way to deal with it?
Shall go into all referenced interfaces, class and mark stuff as <DataContract()>, <Serializable()> and <DataMember()>, which means at least 6-10 c...
I serialize a class which includes a property called Model as IModel but when I try to Deserialize it I'm getting the following exception:
System.Runtime.Serialization.SerializationException: Type 'MYN.IModel' in Assembly 'MYN.Defs, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
It's binary seria...