My interface declarations usually (always?) follow the same scheme. Here's an example:
class Output
{
public:
virtual ~Output() { }
virtual void write( const std::vector<char> &data ) = 0;
protected:
Output() { }
private:
Output( const Output &rhs ); // intentionally not implemented
void operator=( const Output &o...
Is it possible to have an inner class inside the interface in java ???
...
In my quest to correctly grasp Interface best practices, I have noticed declarations such as:
List<String> myList = new ArrayList<String>();
instead of
ArrayList<String> myList = new ArrayList<String>();
-To my understanding the reason is because it allows flexibility in case one day you do not want to implement an ArrayList but m...
I get this random error when I run my app on my iPhone.
First, I tap this method-
-(IBAction)playBeat1 {
NSString *path = [[NSBundle mainBundle] pathForResource:@"beat1" ofType:@"mp3"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[theAudio play];
NSLog...
Hello everyone!
I have inherited a project that has an awkwardly big interface declared (lets call it IDataProvider). There are methods for all aspects of the application bunched up inside the file. Not that it's a huge problem but i'd rather have them split into smaller files with descriptive name. To refactor the interface and break i...
Given:
public interface IA
{
void TestMethod();
}
public interface IB : IA
{
}
Why:
typeof(IB).GetMethods().Count() == 0;
?
Just to be clear:
public class A
{
public void TestMethod()
{
}
}
public class B : A
{
}
typeof(B).GetMethods().Count();
does work (it returns 5);
As a bonus:
typeof(IB).BaseType == nu...
After reflecting upon all the great answers I received to my previous question about modeling my code to maximize code re-use, I started wondering if it would be possible to assign the interface to an object at runtime instead of when it is coded.
Take, for example, a simplified portion of code from my previous question:
public class O...
I have next code:
private T CreateInstance<T>(object obj) // where T : ISomeInterface, class
{
...
if (!typeof(T).IsAssignableFrom(obj.GetType())) { throw ..; }
return (T)obj;
}
Can it be replaced with this:
T result = obj as T;
if (result == null) { throw ..; }
return result;
If not - why?
...
My mate and I are designing/implementing a web based media application. It will provide media management and distribution abilities.
Long story short, as much as we want a web based GUI for users to be able to perform site functionality (CRUD) and also have an administration area to control various aspects of users there is another c...
Hey,
This works:
projections.Add(Projections.Property(Member<MailOrder>.From(x => x.AssigneeCode).QualifiedPath), Member<MailOrderItem>.From(x => x.AssigneeCode).Path);
projections.Add(Projections.Property(Member<MailOrder>.From(x => x.AssigneeName).QualifiedPath), Member<MailOrderItem>.From(x => x.AssigneeName).Path);
proj...
Looking at the Project Server 2010 SDK (found here in .NET Reflector, I have found something interesting that confuses me.
Apparently, the SvcProject.ProjectClient class in ProjectServerServices.dll inherits from System.ServiceModel.ClientBase<Project>, which is an abstract class that implements the System.IDisposable interface. Howeve...
is that even possible?
i have an interface method boolean right(), if it isnt "answering" in a second, it should return false.
...
Hello,
I'm developing some algorithms in OCaml which need some parts to be "pluggable" so that part of the computation is left to specific computators.
Just to make an example suppose I have a signature like this one:
module type Algorithm = sig
val feed : float -> unit
val nth : int -> (float -> float)
end
And two different ...
My purpose is to find out if a class implements an interface directly. In the below example class B implements interface IB and interface IB implements IA.
How to find out the inheritance hierarchy. When we view an type in Object Browser, it shows a detailed hierarchy. How can I achieve similar result.
interface IA
{
string Member1...
Is it possible to use interface method as event handlers in Delphi 2007? The simple versions don't work:
type
TMyEvent = procedure of object;
IMyInterface = interface
procedure Handler;
end;
TMyClass = class(TInterfacedObject, IMyInterface)
public
procedure Handler;
end;
var
ev: TMyEvent;
obj: TMyClass;
intf...
I would like to pass an interface to a method signature which takes Object as its parameter, so I wonder about this question
public Stream GetViewStream(string viewName, object model, ControllerContext context)
instead of object I shall like to pass an interface Imodel, without modifying the signature. Is there a base class for inter...
On a continued mission to clean up the codebase I inherited, via stylecop and fxcop, and one of the warnings from fxcop was CA1801: Parameter 'value' of Something.MyProperty.set(string) is never used. Remove the parameter or use it in the method body.
The code it complains about is:
public class Something : ISomeInterface
public ne...
I came across some code recently that used a custom error handler to turn any PHP errors into an generalized application exception. A custom exception handler was also defined that would log the exception if it was within a particular error code range. Example:
class AppException extends Exception
{
}
function error_handler($errno, $e...
I'm building an application with a Silverlight frontend that communicates with a backend service via WCF. My service has an interface that handles all of the core communication with the frontend.
The backend can be extended with various plugins and I plan on loading custom silverlight modules for configuring these plugins with prism....
I was just wondering if I have the option to specify more than one set of class declarations and definitions in the same file, without breaking it up into multiple files.
I'm guessing this is just the sign to break it up, but I was just wondering out of curiosity.
Also, bonus, when including, what is the difference between #include and...