Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to subclass a complete .vcx?

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hi!
I am having in a map which I do share among several projects a classlib (.VCX) in which there is a form-class (frm).

Once I put in a header-file at that spot into the form-definition than all forms inheret the include-file stuff.

But....
I want to use that classlib for several projects. The header file contains also the app-name, main-dbc etc. Therefore putting the include-file in the form-class overthere is no good idea. So I am wondering about subclassing the whole class-lib into a classlib (same name possible?) in the lib-map of the project. At that spot the include-file may be incoroporated into the forrm-class.

Is that agood solution and how to subclass if possible?
-Bart
 

Take a look at faq184-2409 "Subclass classes"

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike,

nice, and most probably this will fit Barts needs.

But be aware of one problem when subclassing this way:
Let's say I have a classlibrary including a parent class A and a subclass of A called AA.

If you subclass this class library by the code given in the faq you'll get classes A' and AA' and AA' then is no subclass of A' but of AA, which might not, what you need, because then changes of A' won't be inherited by AA'.

In this kind of situations (the original problem was including different project dependant header files) I'd tend to either coping the original lib to each project or put those constants to properties of some public class (app class) and don't work with the constants but with those app class properties.

Bye, Olaf.
 

Olaf said:
If you subclass this class library by the code given in the faq you'll get classes A' and AA' and AA' then is no subclass of A' but of AA, which might not, what you need, because then changes of A' won't be inherited by AA'.

Yes, you are correct. The FAQ should only be used when the class is complete (requires no more changes), but only needs to be used in another project.



Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike,

Well, Mike, right. All in all this is the incapability of foxpro to have polymorphism. Ideal would be, if class AA' would have A' and AA as it's parent classes.

Bye, Olaf.
 
Mike and Olaf,
Thank for your reply but I feel that using your solution brings me back to my start-point.
I had already two seperate class-libs and for the reason of maintaining the classes I liked to return to a single file.
So I think I'd better go and follow Olafs' suggestion to create a public application class and move the header-data into that class.
By the way, why in fact to use header-files in stead of app-class?
I guess it's just a matter of memory consumption or maybe it also concerns the performance of the app?

-Bart
 
Hi Bart,

include files also have their advantages. The defined constants are substituted at compile time and the object code will therefore be faster, because it mustn't read from a property or variable.

But that should be no real performance problem for such things as the application name, database, version etc.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top