Changes

Object Oriented programming

1 byte added, 01:47, December 13, 2019
Minor changes
===Inheritance===
Inheritance is the ability for one class to use the data and methods of an ancestor class (or multiple ancestor classes if multiple inheritance is allowed), rather than having to define those again within a new class. If class B inherits from class A, then class A is called an ancestor class of B, and class B is called a descendant class of A. A decedent class instance can be used in place of any ancestor class instance, but an ancestor class instance cannot be used in place of a descendant class instance.
=== Polymorphism ===
Polymorphism allows an object to be used in place of an ancestor object without the code that is using it having to know about the descendentdescendant. This means that a complex object can appear to be a simple one. The example below shows that you can have a specific model of car, such as the [[Model T]], which looks like and acts like a normal car. Polymorphism can be implemented in different ways. Smalltalk implemented it via messages. Most compilers that support OOP implement a virtual method table, which is an array of method pointers as per the CORBA standard. A descendant class instance can be used in place of any ancestor class instance, but an ancestor class instance cannot be used in place of a descendant class instance.
===Encapsulation===
SkipCaptcha
255
edits