Click here to Skip to main content
16,010,650 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: SQL ? Pin
Hadi Rezaee28-Jul-01 18:58
Hadi Rezaee28-Jul-01 18:58 
Generallogging winsock send/receive Pin
Kuniva26-Jul-01 0:30
Kuniva26-Jul-01 0:30 
Generalclass design question Pin
26-Jul-01 0:25
suss26-Jul-01 0:25 
GeneralRe: class design question Pin
Tomasz Sowinski26-Jul-01 2:50
Tomasz Sowinski26-Jul-01 2:50 
GeneralRe: class design question Pin
26-Jul-01 2:58
suss26-Jul-01 2:58 
GeneralRe: class design question Pin
Tomasz Sowinski26-Jul-01 3:09
Tomasz Sowinski26-Jul-01 3:09 
GeneralRe: class design question Pin
26-Jul-01 3:57
suss26-Jul-01 3:57 
GeneralRe: class design question Pin
Tomasz Sowinski26-Jul-01 4:25
Tomasz Sowinski26-Jul-01 4:25 
shouldn't i reserve memory & copy the szFilename instead of just having m_szFilename member point to it?

Definitely. Use CString or std::string for that.

the derived classes need to use the header file anyway, so they do know the value, don't they?

If you leave the #define in .h the will know, but this isn't a good thing. You're exposing an implementation detail and breaking encapsulation.


What do you mean with create a static function in CInitFile.

If derived classes really need to know what's the default value of filename, you should implement it this way:
// .h
class CInitFile
{
//...
static const char* GetDefaultFilename();
//...
};

// .cpp
const char* CInitFile::GetDefaultFilename()
{
return "Whatever.txt";
}


How would you implement the design so i could force the derived class to make a function to initialise his member data

You can't do that. You don't know what exactly is 'His member data'. Even if virtual function would be called virtually from ctor (it isn't), derived class could simply omit some initializations.

Tomasz Sowinski -- http://www.shooltz.com
GeneralRe: class design question Pin
26-Jul-01 6:04
suss26-Jul-01 6:04 
Generalclass design question Pin
26-Jul-01 0:24
suss26-Jul-01 0:24 
Questionwhats wrong here?? Pin
26-Jul-01 0:14
suss26-Jul-01 0:14 
AnswerRe: whats wrong here?? Pin
Steve T26-Jul-01 12:24
Steve T26-Jul-01 12:24 
GeneralOwner Drawn Buttons Pin
Derek Lakin25-Jul-01 23:22
Derek Lakin25-Jul-01 23:22 
GeneralRe: Owner Drawn Buttons Pin
jerry0davis25-Jul-01 23:33
jerry0davis25-Jul-01 23:33 
GeneralRe: Owner Drawn Buttons Pin
Derek Lakin26-Jul-01 1:45
Derek Lakin26-Jul-01 1:45 
GeneralRe: Owner Drawn Buttons Pin
Paolo Messina26-Jul-01 11:37
professionalPaolo Messina26-Jul-01 11:37 
GeneralRe: Owner Drawn Buttons Pin
Derek Lakin26-Jul-01 21:20
Derek Lakin26-Jul-01 21:20 
QuestionECVT() and FCVT()? Pin
Gérald Mercet25-Jul-01 23:11
Gérald Mercet25-Jul-01 23:11 
AnswerRe: ECVT() and FCVT()? Pin
Gerry26-Jul-01 0:12
Gerry26-Jul-01 0:12 
GeneralI need Help - Dialog Box Pin
Leezo25-Jul-01 21:47
Leezo25-Jul-01 21:47 
GeneralRe: I need Help - Dialog Box Pin
Christian Graus26-Jul-01 12:50
protectorChristian Graus26-Jul-01 12:50 
Generaldisplay a value in an EDITBOX Pin
Gérald Mercet25-Jul-01 21:34
Gérald Mercet25-Jul-01 21:34 
GeneralRe: display a value in an EDITBOX Pin
Gerry25-Jul-01 22:22
Gerry25-Jul-01 22:22 
GeneralRe: display a value in an EDITBOX Pin
Gérald Mercet25-Jul-01 22:30
Gérald Mercet25-Jul-01 22:30 
GeneralRe: display a value in an EDITBOX Pin
Gerry25-Jul-01 23:09
Gerry25-Jul-01 23:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.