Click here to Skip to main content
15,887,746 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralAPI for determining the file system on system disk Pin
abhinarulkar5-Jan-03 22:26
abhinarulkar5-Jan-03 22:26 
GeneralRe: API for determining the file system on system disk Pin
Michael Dunn5-Jan-03 22:28
sitebuilderMichael Dunn5-Jan-03 22:28 
GeneralStatusbar updating Pin
S O S5-Jan-03 22:23
S O S5-Jan-03 22:23 
GeneralRe: Statusbar updating Pin
Iain Clarke, Warrior Programmer5-Jan-03 22:41
Iain Clarke, Warrior Programmer5-Jan-03 22:41 
GeneralA virtual keyboard Pin
Nyrup5-Jan-03 22:17
Nyrup5-Jan-03 22:17 
GeneralRe: A virtual keyboard Pin
Michael Dunn5-Jan-03 22:26
sitebuilderMichael Dunn5-Jan-03 22:26 
GeneralRe: A virtual keyboard Pin
Nyrup5-Jan-03 22:33
Nyrup5-Jan-03 22:33 
GeneralClass Inheritance with different data types Pin
Lord Morlock5-Jan-03 21:47
Lord Morlock5-Jan-03 21:47 
Hi all. I really need some help.

My problem is with inheritance. I have a class type that I want to use several times over for a few VERY similar structures (only 1 variable different). The class mainly contains a linked list, however I don't want to re-write many of the functions just to support the ONE different data type. I have tried doing it this way without success:

<br />
class cGeneric<br />
{<br />
public:<br />
typedef char* DataType;<br />
<br />
struct Node<br />
{<br />
DataType Id;<br />
char *pData;<br />
Node *pNext;<br />
};<br />
<br />
Node *First;<br />
public:<br />
<br />
bool AddItem(DataType Id, char *pData);<br />
<br />
...<br />
<br />
class cExtention : public cGeneric<br />
{<br />
public:<br />
typedef int DataType;<br />
<br />
struct Node<br />
{<br />
DataType Id;<br />
char *pData;<br />
Node *pNext;<br />
};<br />
<br />
Node *First;<br />


In the AddItem function, it just passes the Id (either char* or int) to another function. I know this doesn't work (it reads the information for AddItem from cGeneric since it isn't redefined in cExtention, and so therefore expects a char*) however I would like to know if there is another way to do this.

I haven't done much OOP and I find it a little difficult to swallow at times.

If anyone has ideas of how I could do this, I would greatly appreciate your feedback.

Lord Morlock
~o~
GeneralRe: Class Inheritance with different data types Pin
Michael Dunn5-Jan-03 22:19
sitebuilderMichael Dunn5-Jan-03 22:19 
GeneralRe: Class Inheritance with different data types Pin
Lord Morlock5-Jan-03 22:46
Lord Morlock5-Jan-03 22:46 
GeneralRe: Class Inheritance with different data types Pin
Michael Dunn6-Jan-03 22:17
sitebuilderMichael Dunn6-Jan-03 22:17 
GeneralWant to know version of Windows running Pin
nashdaq5-Jan-03 20:57
nashdaq5-Jan-03 20:57 
GeneralRe: Want to know version of Windows running Pin
Michael Dunn5-Jan-03 21:03
sitebuilderMichael Dunn5-Jan-03 21:03 
GeneralShowing a Dialog Box! Pin
Ehsan Baghaki5-Jan-03 20:50
Ehsan Baghaki5-Jan-03 20:50 
GeneralRe: Showing a Dialog Box! Pin
xxhimanshu5-Jan-03 21:22
xxhimanshu5-Jan-03 21:22 
GeneralRe: Showing a Dialog Box! Pin
Ehsan Baghaki5-Jan-03 21:47
Ehsan Baghaki5-Jan-03 21:47 
Questionhow can i text out some text to a bitmap ? Pin
whelk5-Jan-03 20:07
whelk5-Jan-03 20:07 
AnswerRe: how can i text out some text to a bitmap ? Pin
Davide Pizzolato11-Jan-03 9:15
Davide Pizzolato11-Jan-03 9:15 
Generaldetecting system shutdown Pin
r i s h a b h s5-Jan-03 19:33
r i s h a b h s5-Jan-03 19:33 
GeneralRe: detecting system shutdown Pin
Michael Dunn5-Jan-03 20:23
sitebuilderMichael Dunn5-Jan-03 20:23 
GeneralGetWindowText() problem!!!!!!!!!!!!!!!!!!!!! Pin
xxhimanshu5-Jan-03 18:21
xxhimanshu5-Jan-03 18:21 
GeneralRe: GetWindowText() problem!!!!!!!!!!!!!!!!!!!!! Pin
Michael Dunn5-Jan-03 20:31
sitebuilderMichael Dunn5-Jan-03 20:31 
GeneralRe: GetWindowText() problem!!!!!!!!!!!!!!!!!!!!! Pin
xxhimanshu5-Jan-03 22:42
xxhimanshu5-Jan-03 22:42 
GeneralAssembler designing in VC++ Pin
Sukhdeep5-Jan-03 17:25
Sukhdeep5-Jan-03 17:25 
GeneralHelp with Header files. Pin
VanHlebar5-Jan-03 15:56
VanHlebar5-Jan-03 15:56 

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.