-
Book Overview & Buying
-
Table Of Contents
Rust for C++ Developers
By :
Rust's take on object orientation can be seen as very nontraditional. Rather than creating a direct reimplementation of C++'s flavor of object orientation with small tweaks, Rust's designers chose to rethink object-oriented concepts in the context of the core safety and performance goals of the language.
In this section, we'll take a deeper look at what object orientation means in Rust and how familiar object-oriented concepts are expressed using its language features.
As described earlier, abstraction and encapsulation are good, general software engineering principles in addition to being core tenets of OOP. Rust has support for data hiding and specifying a public API, but this works differently than you might expect coming from C++.
In Rust, everything is private by default, but it's not private to the structure as it might be in a C++ class. Rather, it&apos...