Hi all!
I'm working on an AVL Tree. The tree itself seems to be working but I need a iterator to walk through the values of the tree. Therefore I tried to implement the IEnumerator interace. Unfortunately I get a compile time error implementing IEnumerator and IComparable. First the code and below that the error.
class AvlTreePreOrderE...
Hello everyone,
I am reading the book -- Hadoop: The Definitive Guide
In chapter 2 (Page 25), it is mentioned "The new API favors abstract class over interfaces, since these are easier to evolve. For example, you can add a method (with a default implementation) to an abstract class without breaking old implementations of the class". Wh...
hello guys so i have this assignment that i need to implement interface to go over an ArrayList and sort it (ascending or descnding).I dont want "the" answer i just need some suggestions on my approach and why i get this error
Exception in thread "main" java.lang.ClassCastException: Week7.Check cannot be cast to java.lang.Comparable
a...
Would be correct the next way to implement the methods attached to an interface? (getKey, getData)
type reader interface {
getKey(ver uint) string
getData() string
}
type location struct {
reader
fileLocation string
err os.Error
}
func (self *location) getKey(ver uint) string {...}
func (self *location) getData() ...
So my question is, why to use interfaces or abstract classes? Why are they useful, and for what?
Where can i use them intelligently?
...
I'm trying to use @Autowired annotation with my generic Dao interface like this:
public interface DaoContainer<E extends DomainObject> {
public int numberOfItems();
// Other methods omitted for brevity
}
I use this interface in my Controller in following fashion:
@Configurable
public class HelloWorld {
@Autowired
pri...
Just imagine you have the following class
[DataContract]
public class NamedList
{
[DataMember]
public string Name { get; set; }
[DataMember]
public IList<string> Items { get; private set; }
public DumpList(string name)
{
Name = name;
Items = new List<string>();
}
}
If you serialize this in...
Looking at the (mature) codebase at my new job, there is an interface, and only one class implements it (as far as I can tell). Can/should I get rid of the interface?
...
I'm loading custom user controls into my form using reflection.
I would like all my user controls to have a "Start" and "End" method so they should all be like:
public interface IStartEnd
{
void Start();
void End();
}
public class AnotherControl : UserControl, IStartEnd
{
public void Start()
{ }
public...
I'm creating a class which populates a dictionary as a private member. I want to expose the values of the dictionary without exposing the dictionary itself (in a read-only fashion.) I can easily make a property to expose _dictionary.Keys, but how can I overload [] so that MyClass[key] returns _dictionary[key]?
I think I may need to impl...
I have an interface:
public interface IMech {
}
and a class that implements it
public class Email implements IMech {
}
and a third class that has this method implemented:
public void sendNotification( Class< IMech > mechanism ){
}
now I'm trying to call that method like so
foo.sendNotification(Email.class);
but i keep getti...
I've used Java for some time and I keep hearing about interfaces such as Cloneable, Iterable and other X-ables.
I was wondering if there is a list somewhere of all of these and more importantly - which ones do you regularly use day-to-day?
For example, I've read that Cloneable is considered badly written and isn't widely used.
...
Possible Duplicates:
Interfaces: Why cant I seem to grasp them?
How will I know when to create an interface?
I am using C# and I know what are the interfaces and how syntatically use them,etc.
but what I have not learned yet is that when I am tasked to write a project, create a component,... How should I learn better about i...
Hello, here is the code for my question:
class ICommon
{
public:
virtual ICommon
};
class CSpecial : public ICommon
{
public:
CSpecial
}
};
CSpecial obj;
Basically: I want the interface ICommon to force it's descendants to implement = operator but don't want to have any typecasts in the implementation. The compiler says "can't ...
Ok, a friend of mine go back and forth on what "interface" means in programming.
What is the best description of an "interface".
To me an interface is a blueprint of a class, is this the best definition?
...
I have a number of classes all in the same interface, all in the same assembly, all conforming to the same generic interface:
public class AppleFactory : IFactory<Apple> { ... }
public class BananaFactory : IFactory<Banana> { ... }
// ...
It's safe to assume that if we have an IFactory<T> for a particular T that it's the only one of t...
I'll use the following (trivial) interface as an example:
struct IObject
{
virtual ~IObject() {}
virtual std::string GetName() const = 0;
virtual void ChangeState() = 0;
};
Logic dictates that GetName should be a const member function while ChangeState shouldn't.
All code that I've seen so far doesn't follow this logic, though...
Hello,
Lately i decided to take a look at Java so i am still pretty new to it and also to the approach of OO programming, so i wanted to get some things straight before learning more, (i guess it's never to soon to start with good practices).
I am programming a little 2D game for now but i think my question applies to any non trivial p...
As part of a uni project I have to design an authentication/authorization subsystem for an application. Does anybody have any idea of what I need to include as part of the public interface?
...
Question in the title.
I'd like to avoid recompiling since the source code I'm modifying is third party and I'd like to use the original binaries where possible, and replace only the assembly which contains the class I modified. But I'm not sure if this is a safe thing to do. In C++ for example this is definitely a bad idea.
...