Похожие чаты

I have a question regarding methods returning refrence to the

class itself let's say linker() returns refrence of 'Myclass' and another method tat just does print called output() and I have instance of Myclass created called 'link' so this is the code:
link.linker().output();
Does this have any practical use in real world applications?

5 ответов

19 просмотров

It's called daisy chaining and yes it is used in applications.

TEJTRAX- Автор вопроса
Sander Koenders
It's called daisy chaining and yes it is used in a...

Like what all could it be used with its fine if u give me abstarct examples

TEJTRAX
Like what all could it be used with its fine if u ...

I can give you concrete example. Google for "builder pattern", "lombok builder example". Or you can also check out any rxjava or reactor tutorial, where call chaining is used as main paradigm. By the way, it's also called as "call chaining".

TEJTRAX
Oh thanks a lot

You're welcome. And also it's not necessarily must be "return reference to itself". It may be reference to any other object. Main idea is that the call chain should fluent and readable. Rxjava/reactor actually return you new instance of builder after each call. Also remembered great example: check out something like "spring security configuration", they also use it nicely

Похожие вопросы

Обсуждают сегодня

Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
Мужики и девушки, привет) в Вelphi xe7 в настройках во вкладке "Editor Options" далее " Color" есть список: "Elements", открыв который мы можем настраивать отображение разных...
Kraszx
14
is that okay?
Samurai 🇯🇵
21
Добрый вечер. Есть вопрос, а может и предложение. Был у меня диалог в другой группе о делфи и я задался вопросом: "А нельзя ли в делфи цвет //коментария и {комментария} сде...
Kraszx
24
How about the project bro Likes the community not that active ?
🅿️abby_FX
19
Guys, Donald Trump or Kamala Harris? It does not matter for Bitcoin in the long run!! 2020 Election: After Joe Biden's victory in November 2020, Bitcoin steadily rose from...
Sabah Shabu
1
как быть с принтером? такой подход прокатит?
zamtmn
12
Всем привет! Подскажи, пожалуйста, как передать в TComboBox сразу значение и id записи. На Delphi я делал так: ComboBox1.Items.AddObject('Какое-то значение', Pointer(id запис...
Евгений
13
Мдя, прикол, боевая сборка запускается (именно под отладчиком) после F9 примерно полторы минуты (97 секунд если быть точным). Начал копать - проблема детектится сразу - зависа...
Александр (Rouse_) Багель
38
@brucezli Any info regarding ETA on updates?
Old Man Tom
10
Карта сайта