IT討論區(160) 1337Coder

1001 回覆
6 Like 2 Dislike
2022-05-31 08:37:03
分唔清呢兩個 你當我問緊具體使用 thx
2022-05-31 08:45:41
咁我本身仲有AI+ ML background
差唔多啦
2022-05-31 08:45:58
咁我本身仲有AI+ ML background
差唔多啦
2022-05-31 08:54:47
2022-05-31 09:03:33
手巴唔舉具體語言 純粹general咁講

個this唔同
Let say 而家object a既method 1 forward/delegate比object b既method 2
Forward黎講 個this係b
delegate黎講 個this係a 所以可以access a既protected member/method
2022-05-31 09:11:05
有冇人聽過argyll scott?
收到封email入面有堆2HBU+ dev位,似唔似呃CV?
好似有D too good to be true
2022-05-31 09:21:22
You cannot really control whether the language is a delegate one or a forwarding one.
But you can control how the (child) class behaves differently, according to the caller, without using this.
2022-05-31 09:31:06
There are real consequence of using this, namely protected method/member.

There is stupid hack to use delegation: virtual delegatee method in delegator class, and delegatee derives from delegator so that it can access protected member/method.

A much better way is using friend, eg
class delegatee_base;
class delegator{
friend class delegatee_base;
};
and pass the delegator reference to every delegatee method call. Does not have the syntax sugar of “this”, but I think the syntax sugar is not preferred anyway.
2022-05-31 09:31:54
2022-05-31 09:40:48
That's a good explanation for friend class.
2022-05-31 10:59:12
2022-05-31 10:59:52
2022-05-31 12:14:54
屌那星公司諗住請件nmsl
2022-05-31 12:26:52
Oh gosh I totally forget the stupid language running on billions devices!
Seriously, if Java can be good at one thing, I hope it is garbage collecting and collect itself.
2022-05-31 12:32:00
Sad but sad
2022-05-31 12:33:05
所以咪可以用delegate by inheritance with virtual function 做workaround
雖然咁有啲唔OO
2022-05-31 12:50:07
Tell me more on how Java prevent null pointer exception

Java: less potential, done almost nothing on preventing the most common problem
2022-05-31 12:56:31
And I guess people forget about pascal, Delphi, basic, Visual Basic, qt... when they talk about how Java lower the barrier of writing software quickly.

Java succeeded only because of Netscape supporting applet, not because of being great in software development (hint: it’s not).
2022-05-31 13:00:09
To be clear: I am not saying C++ is great; it’s not especially for most of the modern parts.

The issue is, Java especially sucks, and officially advertise itself as great.
2022-05-31 13:09:15
As I mentioned C++, let’s talk about how traditional C++ sucks.

Stream. WTF.

Luckily there is alternative.

This teaches me one thing: every design will suck in a way you don’t expect. Provide convent alternatives to your users, instead of making alternatives hard or impossible.
2022-05-31 13:13:19
Can’t reach an agreement.

And btw, ppl get job done, not language. If work quality is bad in C++ for some cheap labor, work quality will be bad in Java too.
吹水台自選台熱 門最 新手機台時事台政事台World體育台娛樂台動漫台Apps台遊戲台影視台講故台健康台感情台家庭台潮流台美容台上班台財經台房屋台飲食台旅遊台學術台校園台汽車台音樂台創意台硬件台電器台攝影台玩具台寵物台軟件台活動台電訊台直播台站務台黑 洞