But the thing is, after creating the Classes using the VB Class Builder Wizard, I was even able to give Properties to the Classes, eg. for Class Employee properties will be Employee_name, Employee_ID etc, The main problem is setting new instances of such classes, ie, how do I set it for new instances to take properties of such class!<<
If your class has a property called Employee_Name, then
when you create an instance of the class using
dim MyObject as New MyClass
MyObject becomes a 'working example' of the class.
It will have all the public properties you gave to the class, but none of the private properties will be visible.
eg You will be able to use MyObject.Employee_Name
Public V Private properties:
You might create a 'Piggy Bank' class
It has an 'Add Money' function, and a 'Total Value' property.
These are public. The Total Value property is only declared with a Get function, not a Let, and so is read-only.
It also has a 'Value' property, which holds the actual amount of cash contained. But this is private.
You do this so that no-one can affect the money in the bank simply by doing MyObject.Value = 6 billion pounds
Instead, they have to use MyObject.AddMoney (some value)
This affects the private Value property.
If you want to know how much is in there, you interrogate the TotalValue property, which is safe.
This 'hiding' of stuff that should not be changeable directly is more commonly known as encapsulation.