|
You should read about Virtual Functions & Polymorphism[^].
The converse() method must be virtual in your base class and you need appropriate implementation for this method in the derived classes.
Nuri Ismail
|
|
|
|
|
Not sure I really understood your question: you want all specific Animal do something specific in the converse method ? If that is the case, that is really simple: simply declare the function in the base class (Animal) as a virtual function and override it for each specific animal. Each specific animal can then do something specific.
|
|
|
|
|
Sivyo wrote: I am a bit of a noob with this obviously, so how do I get each object in the array to do what I want it to do?
Reading again the polymorphism chapter on your favourite C++ book may help, I guess.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
hi vc++ programmers,
i am doing an aplication in vs-2008 that is being migrated from vs-2003.I have 10 projects in my application.When i am building my application i am getting all my libraries getting created in release mode...
But when it comes to Debug mode for three projects library folders are not getting created...My application is working in the release mode but not in debug mode....
After compilation my linker->command line: is not showing those three libraries included in debug mode...
Why those three library files are not getting created? please show me any remedy!
Thanks in advance...
|
|
|
|
|
Vetukuri Raju wrote: When i am building my application i am getting all my libraries getting created in release mode...
But when it comes to Debug mode for three projects library folders are not getting created...
This would indicate that there are differences in the debug/release settings, either for the entire application or those three projects.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
hi thanks for the reply...
I checked for all the differences,and checking with 2003vs settings also..but this didnt worked..Migration from 2003 makes any problem?
and can you help further?
|
|
|
|
|
Vetukuri Raju wrote: Migration from 2003 makes any problem?
I can't imagine so given that 70% of your library files are being created.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi they are getting created now,,but those three libraries are not getting linked.but they are getting linked in release mode...
I am not getting those three libraries in my linker->commandline even though i have given those libraries from projectsettings->linker->additional dependencies...
|
|
|
|
|
Hi,
While reading the double value from the written text file, the memory get corrupetd.Here is the sample code and its output for the scenario. Can anyone help in this.
#include <stdio.h>;
#include "stdafx.h"
int main(int argc, char* argv[])
{
double dbleArray[][4] = { -315.00000255999998,0.00000000000000000,0.00000000000000000,-166.19238000000001,
-329.19238000000001,315.00000255999998,-329.19238000000001,-329.19238000000001,
0.00000000000000000,0.00000000000000000,320.00000000000000,-536.00000000000000,
0.00000000000000000,0.00000000000000000,0.00000000000000000,1.0000000000000000};
FILE* pFile = NULL;
pFile = _wfopen(L"C:\\Temp\\InputVolumeDetails.txt", L"w");
if(pFile)
{
for(int nRow=0; nRow<4; nRow++)
{
for(int nCol=0; nCol<4; nCol++)
{
fwrite(&dbleArray[nRow][nCol], sizeof(double), 1, pFile);
}
}
}
fclose(pFile);
double dbleArray_r[4][4];
FILE* pFile_r = NULL;
pFile_r = _wfopen(L"C:\\Temp\\InputVolumeDetails.txt", L"r");
if(pFile_r)
{
for(int nRow=0; nRow<4; nRow++)
{
for(int nCol=0; nCol<4; nCol++)
{
fread(&dbleArray_r[nRow][nCol], sizeof(double), 1, pFile_r);
printf("%f\n",dbleArray_r[nRow][nCol]);
}
}
}
fclose(pFile);
return 0;
}
The output for the above code is
-315.000003
0.000000
0.000000
-92559631348757048000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
-92559631349317831000000000000000000000000000000000000000000000.000000
|
|
|
|
|
Try to change write and read modes to binary L"wb" and L"rb"
|
|
|
|
|
A very subtle situation which is a great lesson for the future. Both your read and write loops contain no error checking. However having completed the write processing, a visual check of the output file suggests that the content is correct. The read loop reads sixteen values and prints them out, but does not check that you have read the full values every time. If you take a look at the file produced by this program you will see the hex value 'x1a' at character position 26. This character is taken by the fread() function as signifying no more data, so the last value read in is incomplete which gives the strange value printed by the program. Every subsequent read will fail so the value stored in memory is whatever was there previously; in this case the values that happen to be in the array storage space. The solution is to always check the results of your read and write statements, but in this case you also need to use "wb" and "rb" on your _wfopen statements to ensure the 'x1A' is not taken as end of file.
|
|
|
|
|
Thanks for all your replies.
I tried with "wb" and "rb" mode and its working fine.
|
|
|
|
|
Good news. But don't forget my comments about error checking, particularly when reading the file. Never assume that the file contents will be correct, however they were created.
|
|
|
|
|
I want to get the default value of the KEY from the registry
if( RegOpenKeyEx (HKEY_CLASSES_ROOT,
"\\AcroExch.Document\\Shell\\Open\\Command",
0,
KEY_QUERY_VALUE, &keyHandle) == ERROR_SUCCESS)
{
size1=260;
RegQueryValueEx (keyHandle,
"Default",
NULL,
&Type,
(LPBYTE)rgValue,
&size1);
sprintf (fnlRes,
"Default value your Windows system is:: %s",
rgValue);
}
I am not able to do so
|
|
|
|
|
RegQueryValueEx (keyHandle, NULL, ...);
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I have created MFC dialog based application using VS 2008 application creation wizard.
In project settings if I use "Use Unicode Character Set" option, I cannot see winXP styles on any of the controls on the dialog,
and If I use "Use Multi-Byte Character Set" option, I can see the winXP styles.
Why this is happening? can't I use "Use Multi-Byte Character Set" option without losing WinXP styles to the control.
Some one please help me out with this issue.
Thanks in advance.
-Rajesh.
|
|
|
|
|
itsmerajesh wrote: In project settings if I use "Use Unicode Character Set" option, I cannot see winXP styles on any of the controls on the dialog,
and If I use "Use Multi-Byte Character Set" option, I can see the winXP styles.
Why this is happening? can't I use "Use Multi-Byte Character Set" option without losing WinXP styles to the control.
1. The two paragraphs are contradictory. The second one is correct. isnt it?
This is because common control version 6 supports only unicode and a dependency to comctrl version 6 is only inculded if the unicode is enabled. Check the stdafx.h you can see the following lines
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
|
|
|
|
|
Actually, if you remove the
#ifdef _UNICODE and the corresponding
#endif the common controls will still work with MBCS and give you the XP look.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
|
Hi All,
In my application I need to execute some commands. For that I am making a .bat file and execute it using Shellexecute(). It is working well for Vista32 bit, but in Vista64 bit machine Shellexecute() is not running these commands(i am running with Admin privileges also). Does ShellExecute() not support Vista64 bit?
Is there any other way for Vista64 bit.
Thanks
Madan
|
|
|
|
|
It's probably some error in your batch file.
First run the batch file manually and check if all the commands work.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for replying. Yes all the commands are correct because if I run this batch file with command prompt then it execute successfully.
Let me explain- I am running following three commands command1)- bcdedit /set {bootmgr} device boot > D:\m1.txt
command2)- bcdedit /set {default} device boot > D:\m3.txt command3)- bcdedit /set {default} osdevice boot > D\m2.txt.
These three commands clears Bootmgr of Vista.
For runnong these commands I make a batch file and execute it with ShellExecute() For seeing output I used pipe. Then after ShellExecute() if I see these m1,m2,m3 files then these are blank.
I am confused now.
|
|
|
|
|
|
Madan Chauhan wrote: ...but in Vista64 bit machine Shellexecute() is not running these commands(i am running with Admin privileges also).
What does it return?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
How can we get the acrobat path reader exe path in VC++
|
|
|
|