Muh inheritance. - /g/ (#105945618) [Archived: 319 hours ago]

Anonymous
7/18/2025, 12:00:16 PM No.105945618
screenshot-18-07-2025-19:57:43
screenshot-18-07-2025-19:57:43
md5: 681d93593fe28977225829f62c522a4c🔍
Replies: >>105945747 >>105946575 >>105946720 >>105946780
Anonymous
7/18/2025, 12:04:59 PM No.105945641
you're going to be written out of the will and inherit diddly squat if you keep posting AI slop young man
Anonymous
7/18/2025, 12:22:36 PM No.105945747
>>105945618 (OP)
look up the -> operator
Replies: >>105945881
Anonymous
7/18/2025, 12:54:35 PM No.105945881
>>105945747
I prefer (*).
Replies: >>105946049
Anonymous
7/18/2025, 1:21:50 PM No.105945989
So clever!
Anonymous
7/18/2025, 1:31:37 PM No.105946049
>>105945881
I prefer for . to automatically dereference pointers to struct
Anonymous
7/18/2025, 1:33:57 PM No.105946057
1729978227284572
1729978227284572
md5: 01f2729feef450bb7ed00470872decf8🔍
>composition over inheritance
Just like the crab ordered.
Anonymous
7/18/2025, 2:34:52 PM No.105946332
>typedef struct
cniles really live like this......
Replies: >>105946528
Anonymous
7/18/2025, 2:47:01 PM No.105946406
God I love OOP!
class Program
{
struct Position : this(int x = 0, int y = 0);
struct Car : this(Position position);
struct Truck : this(
int id,
Position position = default);

static void MoveRight<T>(this ref T vehicle)
where T : var =>
vehicle.position.x += 1;

static void PrintPosition<T>(this T vehicle)
where T : var =>
Console.WriteLine("{}, {}", vehicle.position.x, vehicle.position.y);

static void PrintID(this Truck truck) =>
Console.WriteLine("ID: {}", truck.id);

public static int Main()
{
Car car1 = default;
car1.position.x = 0;
car1.position.y = 0;
car1.PrintPosition();
car1.MoveRight();
car1.PrintPosition();

Truck truck = .(69);
truck.PrintID();
truck.position = .(x: 10, y: 10);
truck.PrintPosition();
truck.MoveRight();
truck.PrintPosition();

return 0;
}
}
Replies: >>105946815
Anonymous
7/18/2025, 3:03:21 PM No.105946518
>typedeffing structs
Replies: >>105946528
Anonymous
7/18/2025, 3:04:20 PM No.105946528
>>105946332
>>105946518
The worst part is that these typedef'ing niggers are the majority of C programmers.
Replies: >>105946554
Anonymous
7/18/2025, 3:10:25 PM No.105946554
>>105946528
the C standard even says typedeffing is bad especiallt when you do shit like yourmom_t
Replies: >>105946720 >>105946822
Anonymous
7/18/2025, 3:14:39 PM No.105946575
>>105945618 (OP)
You can pass car_0 as car.position, just cast it as position.
Anonymous
7/18/2025, 3:37:58 PM No.105946720
>>105945618 (OP)
wow this is

>>105946554
i find it hilarious how much people (rightfully) sneed over hungarian but cniggers love spamming _t bullshit everywhere for no reason
Replies: >>105946734
Anonymous
7/18/2025, 3:39:28 PM No.105946734
>>105946720
Nobody does this except POOSIX trannies.
Replies: >>105946795 >>105946893
Anonymous
7/18/2025, 3:46:24 PM No.105946780
>>105945618 (OP)
hello world moment
Anonymous
7/18/2025, 3:48:07 PM No.105946795
>>105946734
POO SIX saar
Anonymous
7/18/2025, 3:50:19 PM No.105946815
>>105946406
I prefer efficiency.
int main(void) {
return 0;
}
Replies: >>105946820 >>105946823
Anonymous
7/18/2025, 3:51:12 PM No.105946820
>>105946815
That's not efficient.
Replies: >>105946937
Anonymous
7/18/2025, 3:51:20 PM No.105946822
>>105946554
>the C standard even says typedeffing is bad
Source?
Anonymous
7/18/2025, 3:51:24 PM No.105946823
>>105946815
main(){} would be enough in older C versions
Replies: >>105946914
Anonymous
7/18/2025, 4:01:30 PM No.105946893
1752847198
1752847198
md5: b7d5f516b8d886cb69644aa9594f99c4🔍
>>105946734
Just outed yourself as a nocoder.
https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_02_02
Replies: >>105946916
Anonymous
7/18/2025, 4:04:43 PM No.105946914
>>105946823
But invalid in C23 and no more efficient, hence irrelevant.
Anonymous
7/18/2025, 4:05:09 PM No.105946916
>>105946893
>verbatim POOSIX slop
didn't read
Replies: >>105946944
Anonymous
7/18/2025, 4:07:20 PM No.105946937
>>105946820
Doesn't get any more efficient than that. It does the equivalent useful work as that C++ OOPslop.
Replies: >>105946981
Anonymous
7/18/2025, 4:08:21 PM No.105946944
>>105946916
>Didn't contest being a nocoder
I accept your concession.
Replies: >>105946979
Anonymous
7/18/2025, 4:12:51 PM No.105946979
>>105946944
nta but there are more runtimes than just POSIX and NT, and if youre writing C code for a living, chances are youre not working on any of those systems
Anonymous
7/18/2025, 4:13:10 PM No.105946981
>>105946937
It does, nocoder.
Anonymous
7/18/2025, 4:13:55 PM No.105946987
Inheritance is gay and no one uses it in a serious production setting
Replies: >>105947000
Anonymous
7/18/2025, 4:15:17 PM No.105947000
>>105946987
Jews use inheritance all the time, that's how they succeed while goytards like you still dig through shit and seethe constantly about not being able to find a job.