Getting ready

To illustrate the concept of encapsulation, we will create a class that is somewhat complex in its inner working. We need to calculate the thrust-to-weight ratio (TWR) of a space shuttle to determine whether it will be able to take off vertically. It needs to exert more thrust than its weight to counteract gravity and get into a stable orbit. This also depends on which planet the shuttle takes off, because different planets exert different gravitational forces on objects on their surface. In simple terms, the TWR must be greater than one.

Get C# 7 and .NET Core Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.