CHAPTER 1 - Introduction to X++
CHAPTER 2 - X++ Control Statements
CHAPTER 3 - Objects and Classes
CHAPTER 4: Accessing the Database
CHAPTER 5: Exception Handling
CHAPTER 6: Security for Developers
Lesson 4 – Inheritance
Inheritance is a concept where one class can inherit all the methods and variables from another class. A child class inherits the methods of the parent class. Additional methods can be applied to the child class, and inherited methods can be overridden. This means the child class is not always identical to the parent class.
The advantage of inheritance in object-oriented programming is that code can be written one time and be reused many times.
A table can extend from or derive from another table. Each table has the SupportInheritance property and the Extends property, which together control table inheritance.
The default for each new table is to implicitly extend from the Common table. The extension from the Common table cannot be set or seen in the Extends property. A variable that is declared of a specific table also implicitly inherits methods from the xRecord class.
In the terminology for table inheritance, we say that the derived table extends its base table. But we never use the terms parent or child to explain tables in an inheritance relationship. The terms parent and child can be used to describe foreign key relationships between tables.