Click here to Skip to main content
15,889,874 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: CFile::Remove fails Pin
Mike Osbahr20-May-10 7:58
Mike Osbahr20-May-10 7:58 
QuestionRe: CFile::Remove fails Pin
David Crow20-May-10 6:18
David Crow20-May-10 6:18 
AnswerRe: CFile::Remove fails Pin
Luc Pattyn20-May-10 9:18
sitebuilderLuc Pattyn20-May-10 9:18 
GeneralRe: CFile::Remove fails Pin
Mike Osbahr25-May-10 4:54
Mike Osbahr25-May-10 4:54 
QuestionIn-place "conversion" of a string literal into a named object Pin
Code-o-mat20-May-10 4:07
Code-o-mat20-May-10 4:07 
QuestionRe: In-place "conversion" of a string literal into a named object Pin
CPallini20-May-10 11:41
mveCPallini20-May-10 11:41 
AnswerRe: In-place "conversion" of a string literal into a named object Pin
Stephen Hewitt20-May-10 14:13
Stephen Hewitt20-May-10 14:13 
AnswerRe: In-place "conversion" of a string literal into a named object Pin
Code-o-mat20-May-10 21:56
Code-o-mat20-May-10 21:56 
Well, it is a long story, basicly, i want to create a template class that contains some information about the class that inherits from it. All the info is known at the time of declaring the class and is static thoroughout the lifetime of the program. So i thought the simplest way to specify this info would be to make my classes inherit from a template. So i can simply do:
class CSomeClass: public TClassWithInfo<1, 2, 3, "blah">
{
 ...
};

The template also creates some static members. I could of course go with a simple base class and specify the information in the constructor but this means more work + i loose the "automatic static members creation per parameter combination" feature of the template so i would have to declare/define the static members manually for the subclasses...
class CBaseClass
{
public:
  CBaseClass(int one, int two, int three, const char *str);
  ...
};

class CSomeClass: public CBaseClass
{
public:
  CSomeClass();
  ...
};
...
CSomeClass::CSomeClass()
: CBaseClass(1, 2, 3, "oh my god it is full of starts")
{
 ...
}
Also for this to work i would need to add a constructor to CSomeClass that can "relay" the different values of subclasses of CSomeClass to CBaseClass which means even more work...
class CSOmeClass: public CBaseClass
{
public:
  CSomeClass();
  CSomeClass(int one, int two, int three, char *str);
  ...
};
...
CSomeClass::CSomeClass()
: CBaseClass(1, 2, 3, "oh my god it is full of starts")
{
 ...
}

CSomeClass::CSomeClass(int one, int two, int three, char *str)
: CBaseClass(one, two, three, str)
{
 ...
}
...
class CSomeOtherClass: public CSomeClass
{
public:
  CSomeOtherClass();
  ...
};
...
CSomeOtherClass::CSomeOtherClass()
: CSomeClass(2, 3, 4, "Yellow submarine")
{
 ...
}
I think with the template solution i could simplify all the coding need for it by just having to use the template when i declare the class and move along...among the info i would like to specify some string(s), these would mostly be used for debugging. Sadly string literals it can't digest. Having to declare an array of chars eash time i use the template in the header of a class and then having to define it somewhere in the class's cpp seems to be the only way now but it decreases the "easy to use"-ability of the whole concept.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <

QuestionCalling a function directly via VTable. Pin
Green Fuze20-May-10 3:32
Green Fuze20-May-10 3:32 
AnswerRe: Calling a function directly via VTable. Pin
Aescleal20-May-10 3:45
Aescleal20-May-10 3:45 
GeneralRe: Calling a function directly via VTable. Pin
Chris Meech20-May-10 4:19
Chris Meech20-May-10 4:19 
GeneralRe: Calling a function directly via VTable. Pin
Green Fuze20-May-10 6:09
Green Fuze20-May-10 6:09 
GeneralRe: Calling a function directly via VTable. Pin
Aescleal20-May-10 12:32
Aescleal20-May-10 12:32 
QuestionCreate a custom Setup tool to instal other setup programs. (hooking involved.) Pin
Natural_Demon20-May-10 3:24
Natural_Demon20-May-10 3:24 
QuestionCListCtrl Pin
Sakhalean20-May-10 2:52
Sakhalean20-May-10 2:52 
AnswerRe: CListCtrl Pin
CPallini20-May-10 3:02
mveCPallini20-May-10 3:02 
GeneralRe: CListCtrl Pin
Sakhalean20-May-10 3:38
Sakhalean20-May-10 3:38 
GeneralRe: CListCtrl Pin
josda100020-May-10 9:29
josda100020-May-10 9:29 
GeneralRe: CListCtrl Pin
Sakhalean21-May-10 2:41
Sakhalean21-May-10 2:41 
GeneralRe: CListCtrl Pin
josda100021-May-10 3:36
josda100021-May-10 3:36 
GeneralRe: CListCtrl Pin
josda100021-May-10 3:41
josda100021-May-10 3:41 
AnswerRe: CListCtrl Pin
David Crow20-May-10 9:54
David Crow20-May-10 9:54 
GeneralRe: CListCtrl Pin
josda100020-May-10 10:09
josda100020-May-10 10:09 
GeneralRe: CListCtrl Pin
David Crow20-May-10 10:27
David Crow20-May-10 10:27 
GeneralRe: CListCtrl Pin
josda100020-May-10 10:37
josda100020-May-10 10:37 

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.