Questions tagged [delegation]

A delegate is a type that references a method

A delegate is a type that references a method. Once a delegate is assigned a method, it behaves exactly like that method. The delegate method can be used like any other method, with parameters and a return value

761 questions
14
votes
3 answers

Objective-c asynchronous communication: target/action or delegation pattern?

I'm dealing with some asynchronous communication situations (Event-driven XML parsing, NSURLConnection response processing, etc.). I'll try to briefly explain my problem: In my current scenario, there is a service provider (that can talk to a xml…
Lio
  • 4,225
  • 4
  • 33
  • 40
14
votes
2 answers

C++ 11 Delegated Constructor Pure Virtual Method & Function Calls -- Dangers?

Not a Duplicate of Invoking virtual function and pure-virtual function from a constructor: Former Question relates to C++ 03, not new Constructor Delegation behavior in C++ 11, and the question does not address the mitigation of undefined behavior…
e.s. kohen
  • 213
  • 1
  • 4
  • 21
13
votes
1 answer

Kotlin class delegation, passing this to delegate

Is there any possibility to pass this when delegating class in kotlin? class SomeFlow : Flow, SmsAuthentication by DefaultSmsAuthentication(this) It says this does not exist in this context. The other class looks like this: class…
Julian Rubin
  • 1,175
  • 1
  • 11
  • 23
12
votes
1 answer

How can I delegate an implementation to a mutable property in Kotlin?

As to my understanding, the idea of delegating an implementation in Kotlin is to avoid code that looks like this: class MyClass(val delegate : MyInterface) : MyInterface { override fun myAbstractFun1() = delegate.myAbstractFun1() override…
msrd0
  • 7,816
  • 9
  • 47
  • 82
12
votes
2 answers

Delphi: How delegate interface implementation to child object?

i have an object which delegates implementation of a particularly complex interface to a child object. This is exactly i think is the job of TAggregatedObject. The "child" object maintains a weak reference to its "controller", and all QueryInterface…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
12
votes
3 answers

delegating into private parts

Sometimes, C++'s notion of privacy just baffles me :-) class Foo { struct Bar; Bar* p; public: Bar* operator->() const { return p; } }; struct Foo::Bar { void baz() { std::cout << "inside baz\n"; …
fredoverflow
  • 256,549
  • 94
  • 388
  • 662
11
votes
4 answers

Rails / Rspec - writing spec for delegate method (allow_nil option)

Given the code below: (1) How would you go about writing a spec to test the :allow_nil => false option? (2) Is it even worth writing a spec to test? class Event < ActiveRecord::Base belongs_to :league delegate :name, :to => :league, :prefix =>…
keruilin
  • 16,782
  • 34
  • 108
  • 175
11
votes
1 answer

Interface delegation on Win64

Documentation states that interface delegation is available for Win32 only. Currently I can't test it, is it documentation bug or interface delegation is discontinued in 64-bit compiler?
kludg
  • 27,213
  • 5
  • 67
  • 118
11
votes
3 answers

How to properly deal with a deallocated delegate of a queued nsoperation

In my current project, several view controllers (like vc) spawn NSOperation objects (like operation) that are executed on a static NSOperationQueue. While the operation is waiting or running, it will report back to the view controller via delegation…
epologee
  • 11,229
  • 11
  • 68
  • 104
11
votes
1 answer

ASP.NET passing along Windows Authentication credentials

I've got an ASP.NET web application which uses Windows Authentication. This application needs to connect to another ASP.NET web service (which also uses Windows Authentication) and use the same credentials that it received from the user's browser.…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
10
votes
3 answers

Kerberos, delegation and how to do this correctly?

I've got two separate homemade applications that need to communicate among themselves. One is a frontend application (asp.net actually), the other is a backend interface to an accounting application. The backend interface was not created…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
10
votes
1 answer

Access denied impersonating current user accessing network folder

Trying to list the directories and files within a specific folder. This folder will depend on the current user (Page.User) which logs in by Windows Authentication (NTLM) and is retrieved from the Active Directory (homedirectory property). I am using…
Perbert
  • 465
  • 1
  • 7
  • 17
9
votes
4 answers

Objective-C Delegation Explained to a Java Programmer

I am fairly new to Objective-C, but experienced in Java. Is there the equivalent concept of Objective-C "delegation" in Java, so that I may understand this notion better? Would there be a way to emulate the delegation concept in Java?
Julien Chastang
  • 17,592
  • 12
  • 63
  • 89
9
votes
3 answers

Delegating events to a parent view in Backbone

My view, TuneBook, has several child views of type ClosedTune. I also have separate full page views for each tune, OpenTune. The same events are bound within ClosedTune and OpenTune, so I've designed my app so that they both inherit from a shared…
wheresrhys
  • 22,558
  • 19
  • 94
  • 162
8
votes
6 answers

What patterns do you use to decouple interfaces and implementation in C++?

One problem in large C++ projects can be build times. There is some class high up in your dependency tree which you would need to work on, but usually you avoid doing so because every build takes a very long time. You don't necessarily want to…
Tobias
  • 6,388
  • 4
  • 39
  • 64
1 2
3
50 51