Classes - in a business environment
Ok we use classes to define Table properties and methods.
For example we have a class called Customer. This is built with a property for each field in the Table, and a method for add, modify, search, delete, etc.
Now in the class we define the business rules related to Customers. A good example is all Customer records must have something in the Name field. Therefore if a Customer record is added or modified and nothing is in the Name field an error is generated and the Table is not updated.
Ok now for the really good stuff. The Customer table is defined once as a class, and can be re-used throughout a project or any number of projects. If a change occurs to the business rules, we only have to make that change in one place, not in multiple places.
Ok that was a simple example of classes as used in business, they form the basis of object orientated programming.
kedaman interesting interpretation
If you create a class called Angle, then automatically the class Angle becomes an object with properties and methods. As some one stated above, an object is just an interation of a class. True OOP demands that a class must be re-usable and must be able to generate multiple instances. Therefore even an application like Excel becomes an object for vb with properties and methods.
I still have problems understanding sub-classing and inheritance.
William your absolutely right on this
All programs, apps, whatever in the windows environment are objects. However version 7 of vb is expected to be fully OOP therefore am trying to get as much info on sub-classing and inheritance as possible, to see what advantages effects this will have on existing apps, and design requirements for new apps. Classes should have shown even the most ardent anit-OOP programmers the advantages of this approach, therefore sub-classing and inheritance are likely to hold even better benefits. Of course MS might just rethink what this stuff should mean, and set their own view on it.
Actually William...............
........the guru stuff was aimed at Megatron and kedaman.
Jethros interesting interpretation
Well Jethro I hope you know what youre doing... 100 modules and 50 classes in a project? Well I would like to know what happens if you have all those modules and classes loaded at the same time in vb, my resources would go down to 0 with 30 classes.
And for anyone that didn't know, batman is back and so is the security of this site.
kedaman...oh yeah it's resource hungry
Ok the app runs on the back of a four pentium chip server with gigs of ram. The client side, which l am almost finished, only has a couple of bas, three classes, and approx 10 or so windows.
What the server side does is extract multiple record layouts from a number of different database types, (SQL, informix, Universe,etc etc etc), dependant on client requirements. This is then added to Country specific information which then generates a specific Access file for a Sales guy to download to his/her portable.
Way heavy stuff.............
Without classes we would be totally rooted, trying to tie in all the db layouts throughout the project.