Superclasses and Subclasses
  • 04 Oct 2023
  • 2 Minutes to read
  • Dark
    Light

Superclasses and Subclasses

  • Dark
    Light

Article Summary

Overview 

Superclasses are components of data inheritance where certain properties, attributes, or characteristics of an entity are inherited or passed down from a parent object to its child objects or entities. Superclasses function as the highest tier of classification within a structure. They encapsulate shared attributes common to all descendant elements in the child classes. This setting is available in Flow Structures, Defined Data Structures, and Entities. Superclasses, often referred to as parent classes, pass down their properties and characteristics to their subclasses.

Use Cases

Example Use CaseDescription
Investment ProductsFinancial institutions often offer a range of investment products like stocks, bonds, and mutual funds. Using inheritance, create a superclass that captures shared attributes like market value and risk level, with subclasses specifying details unique to each investment type.
Payment ProcessingPayment processing systems can benefit from inheritance to handle different payment methods. A superclass might contain general payment information, while subclasses represent specific payment types like credit cards, electronic funds transfers, or cryptocurrencies.
Medical ConditionsIn healthcare systems, you can model medical conditions with a superclass, including common attributes like a diagnosis date and treatment plan. Subclasses could represent specific conditions such as diabetes, hypertension, or allergies, each with its unique treatment protocols.
Patient RecordsIn a healthcare database, patient records can be structured using inheritance. A superclass might include general patient information, while subclasses capture details related to specific patient types, such as inpatient, outpatient, or pediatric records.

Create a Superclass

  1. In a Designer Project, click CREATE DATATYPES/INTEGRATIONS and click Defined Data Structure.  
  2. In the Structure Type Name field, enter "Payment". This will be the superclass.
  3. Under Name, enter the following data members: Payment ID, Payment Amount, Payment Date, Payment Method, Payment Status. Click SAVE.

Create a Subclass

  1. In the same Designer Project, click CREATE DATATYPES/INTEGRATIONS and select Defined Data Structure.
  2. Enter a Payment Method like "CreditCardPayment" or "ElectronicFundsTransfer" in the Structure Type Name field. 
  3. Under the ADVANCED category, enter the superclass type namespace in the Super Class field.
    The Superclass input utilizes both the Type Name Space and the Structure Type namespace of the superclass to determine which class to inherit traits from. The input is case sensitive and is formatted as the Type Name Space, a period, and then the Structure Type Name.
  4. Define data fields under Name and configure the Type for each. Click SAVE to create the subclass.
CreditCardPaymentElectronicFundsTransfer
CardholderNameBank Name
Card Number Account Holder
Expiry DateAccount Number
CVVRouting Number
Billing AddressTransaction Reference

Expected Result

In a Flow, set up two types of data structures: "CreditCardPayment" and "Payment." These structures are used as inputs on a Create Data step. Select Build Data as the mapping type for both inputs to see the data fields within each structure. Notice that the CreditCardPayment structure has successfully inherited the data fields from the Payment structure.


For further information on Data Structures, visit the Decisions Forum.

Was this article helpful?