Click here to Skip to main content
15,907,913 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralObtaining process handle Pin
Shah Shehpori5-Jan-03 23:27
sussShah Shehpori5-Jan-03 23:27 
GeneralRe: Obtaining process handle Pin
Kannan Kalyanaraman6-Jan-03 0:43
Kannan Kalyanaraman6-Jan-03 0:43 
GeneralMultiple file types Pin
S O S5-Jan-03 23:08
S O S5-Jan-03 23:08 
GeneralRe: Multiple file types Pin
Iain Clarke, Warrior Programmer5-Jan-03 23:32
Iain Clarke, Warrior Programmer5-Jan-03 23:32 
GeneralRe: Multiple file types Pin
S O S6-Jan-03 1:29
S O S6-Jan-03 1:29 
GeneralRe: Multiple file types Pin
uandrej6-Jan-03 3:31
uandrej6-Jan-03 3:31 
GeneralRe: Multiple file types Pin
Iain Clarke, Warrior Programmer6-Jan-03 4:58
Iain Clarke, Warrior Programmer6-Jan-03 4:58 
Generaltcp api calls Pin
Prince Manatt5-Jan-03 22:57
Prince Manatt5-Jan-03 22:57 
GeneralRe: tcp api calls Pin
viliam6-Jan-03 3:09
viliam6-Jan-03 3:09 
GeneralCustom resources Pin
S O S5-Jan-03 22:43
S O S5-Jan-03 22:43 
GeneralWinsock related Pin
Kamran Jamal5-Jan-03 22:40
sussKamran Jamal5-Jan-03 22:40 
GeneralRe: Winsock related Pin
Stefan Pedersen6-Jan-03 3:41
Stefan Pedersen6-Jan-03 3:41 
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 

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.