interface

Resolve naming conflicts caused by interface inheritance in Delphi

孤者浪人 提交于 2020-01-17 03:43:17
问题 If i have these 3 interfaces unit Interfaces; interface type IA = interface['{86367399-1601-4FDD-89CF-362E762D948E}'] procedure doSomething; end; IB = interface['{070B9364-4A57-4E5A-BBA7-FBF1C6A48C5A}'] procedure doSomething; end; IC =interface(IB)['{DAC8021C-42CB-40EC-A001-466909044EC3}'] procedure doSomething; end; implementation end. How do i resolve naming conficts in a class that implements IA and IC? I have no problem with IA and IC but how do i implement IB? type myClass = class

why are interfaces created instead of their implementations for every class

这一生的挚爱 提交于 2020-01-17 01:15:15
问题 It seems to be the standard so I have been going along with it so far, but now I am building a new class from scratch instead of modifying the old ones and feel I should understand why I should follow the projects convention. Almost every class has an interface to it which is called classnameable . In the code database.class would never appear even once but in place where I would want to use that class I see databaseable.class . To my understanding an interface was a class that was never

Constraining generic types by extrinsic functionality

ε祈祈猫儿з 提交于 2020-01-16 09:29:15
问题 Background: I am working with an organization that has an ever-growing collection of data types that they need to extract data from. I have no ability to change these data types. Some are machine-generated from XML files provided by other organizations; some are controlled by intransigent internal dev teams; and some are so old that no one is willing to change them in any way for fear that it will destabilize the entire Earth and cause it to crash into the sun. These classes don't share any

When do I want to declare interface over the actual class?

醉酒当歌 提交于 2020-01-16 04:38:28
问题 For example, I often see this: Set<Integer> s = new TreeSet<Integer>(); Set<Integer> s = new HashSet<Integer>(); Map<Integer, String> m = new HashMap<Integer, String>(); over TreeSet<Integer> ts = new TreeSet<Integer>(); HashSet<Integer> hs = new HashSet<Integer>(); HashMap<Integer, String> hm = new HashMap<Integer, String>(); What are the advantages/disadvanges of the former vs the latter? 回答1: For me it comes down to a number of points. Do you care about the implementation? Does your code

Getting the current status of process/service anytime the activity starts

江枫思渺然 提交于 2020-01-16 01:03:23
问题 I have made the intent service and its all working fine. I have made the interfaces and made call backs. What call back does , it receives 3 following messages : Service Start: When this message arrives, my "Start Service" button changes into "Stop Service" button. Service Finished: when this message arrives my button gets disappear Error: when this message arrives my button change into the "Error" button. The call back is working perfectly. now I have following problems noticed when testing.

Java - An interface that has static field pointing to class name of its sub class?

别说谁变了你拦得住时间么 提交于 2020-01-15 11:08:49
问题 I want an interface, which its sub class can inherit a static field, that field points to the name of the sub class. How can I do that? For example in my mind (the code is unusable): public interface ILogger<A> { public static String LogTag = A.class.getName(); } public class Sub implements ILogger<Sub> { public Sub() { Log.debug(LogTag, ...); } } 回答1: In Java, unlike C++, this is not possible due to the way that generics are implemented. In Java, there is only one class for each generic type

removing redundant type in Interface

拈花ヽ惹草 提交于 2020-01-15 08:15:12
问题 I have following interfaces public interface IRevision<TRevisionType> { ... } public interface IRevisionLog { ... } public interface IRevisionControl<in TRevision, TLogType,T> where TRevision : IRevision<T> where TLogType : IRevisionLog { ... } This code compiles fine, but I am wondering, is this last one T really needed? When i implement IRevision I will be passing type T, so there is really no need to duplicate type. My demo implementation would be: public class HgRevision : IRevision

Passing Variables from VBA to R-Script

核能气质少年 提交于 2020-01-15 07:21:26
问题 I am currently working on an Interface which connects R and Excel. I am up to now able to execute a R programm via a VBA Macro. I used the recommandations given on http://shashiasrblog.blogspot.fr/2013/10/vba-front-end-for-r.html Since my R-Script invokes external txt-files, it would be nice not to change the R code manually, when changing the directories of the corresponding files. So the question is, is it possible to assign variables from a VBA Script to R . I did not manage to be

Passing Variables from VBA to R-Script

点点圈 提交于 2020-01-15 07:21:08
问题 I am currently working on an Interface which connects R and Excel. I am up to now able to execute a R programm via a VBA Macro. I used the recommandations given on http://shashiasrblog.blogspot.fr/2013/10/vba-front-end-for-r.html Since my R-Script invokes external txt-files, it would be nice not to change the R code manually, when changing the directories of the corresponding files. So the question is, is it possible to assign variables from a VBA Script to R . I did not manage to be

Freeing interfaced object that descends from a TRectangle

梦想与她 提交于 2020-01-15 06:58:05
问题 I'm new to interfaces and have been trying them out in my latest project. I have this (simplified) interface: IBoardShape = interface(IInterface) function GetColor: integer; procedure SetColor(const aColor: integer); property Color: integer read GetColor write SetColor; end; Several classes descend from it like so: TGameRectangle = class(TRectangle, IBoardShape) private FColor: integer; function GetColor: integer; procedure SetColor(const aColor: integer); property Color: integer read