Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
So why classes?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00536554
Message ID:
00540174
Views:
17
>This is kind of a beginner (easy?) question. I've been learning VFP this last month at a new job, coming from C++ background. I can see why classes in C++, but why classes in VFP.

Imagine you wanted every form in your app (say 15+) and you all wanted them to get their caption the same way, restore their last size and position, use the same error handler, and all register themselves with some sort of form manager. If you create one form class to do that, you can base all 15 forms on that class, and whnever you make a change to the inherited methods, all 15 forms change. No subclassing involved, just a class, and a bunch of forms based on a class, though, you could subclass that to create a form class with more specific behavior, and create mutiple forms from that, if required.

Now imagine that you wanted to add field level security to the 30+ textboxes on each of the 15+ forms. I sure hope all those controls are based on a commonn class so you only need to make the change once, instead of 150 times.

Also, imagine you need a chunk of code for functinoality, but no user interface. You can use Non-Visual classes for that too. You can also use them to create COM servers in VFP.
Previous
Reply
Map
View

Click here to load this message in the networking platform