[Dlang Episode 107] Classes - part 1 of N - Reference Type vs Value type (and how ‘ref’ is used)

preview_player
Показать описание

►Lesson Description: In this lesson I finally introduce the 'class' keyword in the D language. A class enables many more object-oriented features, namely run-time polymorphism (dynamic dispatch), message passing, and inheritance. In this video we'll focus on the different semantics of working with a class (a reference type) versus a struct. As always, share your interesting use cases with the community in the discussion below!

►Please like and subscribe to help the channel!
Рекомендации по теме
Комментарии
Автор

I am happy that you do videos on OOP in D.

bitpilot
Автор

If we pass a 'reference type' by 'ref' and thus a new object will be allocated in func1(), wouldn't the cat1class no longer be pointing to the CatClass allocated in main()? Thereby causing a memory leak.

kyleheaser
Автор

TBH: I was not aware that members (fields) of classes are public by default in D (?)

bsdooby