V
V
VMesser2017-03-15 12:49:42
Visual Basic
VMesser, 2017-03-15 12:49:42

Collection of objects, how best to organize?

I write on VBA some kind of automation for Excel.
I want to create a collection of objects. I create two classes, one for the collection, the other for the object. I want to add an object to the collection automatically when it is initialized.
Question 1:
Is it nice from the point of view of OOP to call the methods of another class from the methods of one class?
Question 2:
How to implement such a call, using the object itself as a parameter, did not google.
An object must have a method that adds this object to the CollectionClassVariable collection:

Public Sub AddToCollection()
    CollectionClassVariable.Add Me ' Me - это некий референс на объект изнутри его метода. Не знаю, как сделать. 
End Sub

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question