In OOP there are relationships called is-a and has-a. Is-A deals with inheritance. Let's say I have an Animal class and a Dog Class that inherits from Animal class. In this case Dog is-a Animal.
Code:
' Is-a relationship
Class Animal
{
}
Class Dog: Public Animal
{
}
With a Has-A relationship we are referring to containment (one object containing another). For example I would have a car class and a engine class. The car class would contain an instance of the engine class.
Code:
' Has-a relationship
Class Engine
{
}
Class Car
{
Engine e;
}
My question is can we use has-a relationship designs using class modules in VBA like other OOP languages. Can we have a class module that contain an instance of another class module.
Thank You.