shortsighted design - so can I do this now?
-
I made a database class and the Open() function is quite flexible but opens a recordset based on a specific query. Its too involved to remove that inflexibility. Now I am wanting to use my database class but open with a whole different query. SO is it okay if I have a function called DbClass::Open2() which opens a database based on my new specific query (I may make Open2 be able to take any query but for the moment not). then when I want to open a database with my new query I can instantaite a new db object and call its open2 which in no way will interere with the db object which called Open1 (the original). Any comments? I know this is not good programmmming but do you agree that I can call two different versions of Open if I so desire... Thanks, ns
-
I made a database class and the Open() function is quite flexible but opens a recordset based on a specific query. Its too involved to remove that inflexibility. Now I am wanting to use my database class but open with a whole different query. SO is it okay if I have a function called DbClass::Open2() which opens a database based on my new specific query (I may make Open2 be able to take any query but for the moment not). then when I want to open a database with my new query I can instantaite a new db object and call its open2 which in no way will interere with the db object which called Open1 (the original). Any comments? I know this is not good programmmming but do you agree that I can call two different versions of Open if I so desire... Thanks, ns
Just call it Open but use different parameters. C++ will be able to figure it out. Its called method overloading.
Jason Henderson
quasi-homepage
articles
"Like it or not, I'm right!" -
I made a database class and the Open() function is quite flexible but opens a recordset based on a specific query. Its too involved to remove that inflexibility. Now I am wanting to use my database class but open with a whole different query. SO is it okay if I have a function called DbClass::Open2() which opens a database based on my new specific query (I may make Open2 be able to take any query but for the moment not). then when I want to open a database with my new query I can instantaite a new db object and call its open2 which in no way will interere with the db object which called Open1 (the original). Any comments? I know this is not good programmmming but do you agree that I can call two different versions of Open if I so desire... Thanks, ns
Why not rename Open to something more descriptive and change our code? Then add another function for your 2nd query. Use something like QueryCustomers and QueryProducts instead of Open and Open2. Todd Smith
-
Why not rename Open to something more descriptive and change our code? Then add another function for your 2nd query. Use something like QueryCustomers and QueryProducts instead of Open and Open2. Todd Smith
-
Just call it Open but use different parameters. C++ will be able to figure it out. Its called method overloading.
Jason Henderson
quasi-homepage
articles
"Like it or not, I'm right!" -
void MClass::Open() void MClass::Open(int i) void MClass::Open(char c) Are different functions of the same class with the same name but having different parameters. This is called function overloading.
Jason Henderson
quasi-homepage
articles
"Like it or not, I'm right!"