General information
Category:
Coding, syntax & commands
>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.
>
>Perhaps we just aren't taking advantage of classes at work properly. Right now, I make a form into a class. Well why make a form into a class, when I can just keept he form as a form. Besides Heirarchy order (Having a classlib with classes in it, as an ordering device)...i'm just having a hard time figuring out what the use is...
If you write 2+ "Data Entry" Forms that each operate on a different table, and you have another 2+ Forms that use a Parent and Child table, etc. ... you soon start to notice a "pattern" or that you're duplicating a certain amount of code (eg. Add logic, Delete logic, etc). In the old days, we would "reuse" this code by creating function libraries; now, we put that code in a "class" and use a subclass to "inherit" that code. The Forms you subclass account for the differences: eg. validation rules, the fields on the screen, etc.
You could write a couple of forms first that aren't subclassed just to identify your patterns, but given enough forms, at some point there will be code that seems a likely candidate for a parent class, in order to simplify "common code" maintenance and reuse.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only