Object Orientated
This is a style of programming that represents concepts as objects, actions as methods and attributes as properties.
There are four core concepts when we talk about object orientated programming.
VBA does not support implementation inheritance.
VBA does support polymorphism.
VBA does support encapsulation.
Inheritance
Ability for a derived class to inherit the methods of a base class.
VBA does not support implementation inheritance.
Interface Inheritance - This is provided by the Implements keyword and lets you implement an interface differently in multiple classes.
Implementation Inheritance - Not supported in VBA. This is the ability to inherit method implementation from a base class in a derived class.
VBA does not implement derived classes, it exposes the methods that need to be implemented.
VBA does not implement interfaces, it exposes the methods that need to be implemented.
Polymorphism
Ability for a base class to implement from a derived class.
Ability for an object to decide its implementation at runtime.
If there are two classes that implement the same method you can invoke the method without knowing which class the object has been derived from.
Encapsulation
This is an implementation level process, and it is used to provide privacy and maintain control over the transparency of data at the implementation stage of a project.
Ability to keep fields, methods and properties private in a class to prevent them being accessed from outside the class.
Using Private keyword to hide variables, methods and properties inside a class.
Abstraction
This is a design level process and it is used to reduce the complexity at the designing stage
Ability to hide complexity and present a more abstract picture.
Focused on what the object does instead of how it does it.
In other languages this is achieved with interfaces and abstract classes.
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext