interface

Interface “recursion” and reference counting

喜夏-厌秋 提交于 2020-01-01 03:30:29
问题 I have a small problem with interfaces. Here it is in Pseudo code : type Interface1 = interface end; Interface2 = interface end; TParentClass = class(TInterfacedObject, Interface1) private fChild : Interface2; public procedure AddChild(aChild : Interface2); end; TChildClass = class(TInterfacedObject, Interface2) private fParent : Interface2; public constructor Create(aPArent : Interface1); end; Can anyone see the flaw? I need the child to have a reference to it's parent, but the reference

How do I remove implementing types from GWT’s Serialization Policy?

只谈情不闲聊 提交于 2020-01-01 03:21:11
问题 The opposite of this question: How do I add a type to GWT's Serialization Policy whitelist? GWT is adding undesired types to the serialization policy and bloating my JS. How do I trim my GWT whitelist by hand? Or should I at all? For example, if I put the interface List on a GWT RPC service class, GWT has to generate Javascript that handles ArrayList, LinkedList, Stack, Vector, ... even though my team knows we're only ever going to return an ArrayList. I could just make the method's return

Are delegates not just shorthand interfaces?

夙愿已清 提交于 2020-01-01 02:53:04
问题 Suppose we have: interface Foo { bool Func(int x); } class Bar: Foo { bool Func(int x) { return (x>0); } } class Baz: Foo { bool Func(int x) { return (x<0); } } Now we can toss around Bar and Baz as a Foos and call their Func methods. Delegates simplify this a little bit: delegate bool Foo(int x); bool Bar(int x) { return (x<0); } bool Baz(int x) { return (x>0); } Now we can toss around Bar and Baz as Foo delegates. What is the real benefit of delegates, except for getting shorter code? 回答1:

Understanding 'TypeElement' and 'DeclaredType' interface in java

坚强是说给别人听的谎言 提交于 2020-01-01 02:52:12
问题 One usage of these two interface, is to write annotation processor. As a java beginner, I find the level of indirection that is added by these two packages: javax.lang.model.element & javax.lang.model.type to provide metadata about java interface and java class confusing. ......... java doc comments say, TypeElement represents a class or interface program element. Provides access to information about the type and its members. Note that an enum type is a kind of class and an annotation type is

How do you implement an interface in IronPython?

本小妞迷上赌 提交于 2020-01-01 02:26:29
问题 The FAQ that comes with IronPython 2.0.1 says the following: You can define interfaces in C#, build those into a DLL, and then implement those interfaces in Python code as well as pass the python objects that implement the interfaces to C# code. I have googled and googled and googled, but haven't found how to do this. Can someone help? 回答1: I'm not sure of this, but it looks like you could do it with the regular inheritance syntax of python: class SomeClass (ISomeInterface): def SomeMethod

Is it possible to define valid C# interface that cannot be implemented? [closed]

此生再无相见时 提交于 2019-12-31 10:46:14
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I'm thinking about this (meta) question for couple of days already: Is it possible to define valid C# interface, that cannot be

Is there a “right” way to do inheritance in JavaScript? If so, what is it?

☆樱花仙子☆ 提交于 2019-12-31 10:02:09
问题 I have been trying to learn how to add testing to existing code -- currently reading reading Working Effectively With Legacy Code. I have been trying to apply some of the principles in JavaScript, and now I'm trying to extract an interface. In searching for creating interfaces in JavaScript, I can't find a lot -- and what I find about inheritance seems like their are several different ways. (Some people create their own base classes to provide helpful methods to make it easier to do

Delphi with HTML/CSS interface

旧巷老猫 提交于 2019-12-31 09:48:10
问题 I want to develop a delphi application with an HTML/CSS graphical user interface, not necessarily running from within a web browser. I want to do this do create a richer graphical user interface with animations etc. and break away from normal VCL components / Windows look. Any suggestions? 回答1: In one of my applications I have an an embedded browser and I have implemented the IDocHostUIHandler interface. This allows me to expose a COM object via the "GetExternal" method. I simply have a COM

iPhone app converting to iPad? [closed]

泪湿孤枕 提交于 2019-12-31 09:45:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I want to convert my app to a Universal app. Can anyone recommend some good tutorials for achieving this? I need to have each View in Interface Builder as a separate, view for iPhone or iPad. Thanks in advance! 回答1: I just did this mostly manually, using approximately the following steps: Load the app's main

Duck typing and (java) interface concept

非 Y 不嫁゛ 提交于 2019-12-31 08:58:27
问题 I just read the Wikipedia article about duck typing, and I feel like I miss an important point about the interface concept I used to in Java: "When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck." class Duck: def quack(self): print("Quaaaaaack!") def feathers(self): print("The duck has white and gray feathers.") def swim(self): print("Swim seamlessly in the water") class Person: def quack(self): print("The person imitates a duck.")