Похожие чаты

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 ответов

20 просмотров

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

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

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

30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
Чёт не понял, я ж правильной функцией воспользовался чтобы вывести отладочную информацию? но что-то она не ловится
notme
18
Привет)) уже кажется эту тему перемусолили, но вот я так и не понял. Я сейчас сижу на 27дюймов 2к мониторе. На Актуальной макоси, если я куплю 27д 4к монитор: - будет ли изобр...
Vladislav Piskunov
16
Also, why can’t the community have a vote/ say when it comes to initiatives like buybacks. Isn’t the point of crypto decentralisation? Don’t we deserve input as long term supp...
👨🏽‍🦰
13
any reference of this implementation?
BitBuddha
29
Страшнейшая правда про списки ЦБ. С первых дней жизни P2P сферы, молодые человеки, начитавшись законодательной базы и "внутренних" документов, решили, что им противостоит сер...
Foxcool
3
У меня есть функция где происходит это: write_bit(buffer, 1); write_bit(buffer, 0); write_bit(buffer, 1); write_bit(buffer, 1); write_bit(buffer, 1); w...
~
14
Hi guys, any problem with Pulsebrige? Trying to transfer from wETH to ETH. First it tells me to connect my metamask "through mobile app" not desktop. Then I did and confirmed ...
Snowflakecrypto
13
Карта сайта