21
submitted 7 months ago by cm0002@digipres.cafe to c/rust@programming.dev
top 4 comments
sorted by: hot top new old
[-] FizzyOrange@programming.dev 14 points 7 months ago

Rust doesn't have inheritance like in traditional OOP languages because it doesn't have virtual methods. You have to manually implement methods to delegate to base classes.

Also what is this trash meme?

[-] TehPers@beehaw.org 8 points 7 months ago

There is inheritance in Rust. It even comes with the same variance confusion that you find in languages like C# and Java.

[-] calcopiritus@lemmy.world 4 points 7 months ago* (last edited 7 months ago)

Deref works on top of encapsulation though. Inheritance syntactically hides the encapsulation, with Deref it's in the clear.

It's true that it feels like inheritance, but I'm grateful for it. Otherwise it would be a pain to use the windows API.

[-] jenesaisquoi@feddit.org 2 points 6 months ago

All my homies love composition over inheritance

this post was submitted on 01 Feb 2026
21 points (70.6% liked)

Rust

8252 readers
13 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 3 years ago
MODERATORS