|
Thanks, I'll be aware of that in the future.
'Bomb-proof', reminds me of the old Atari ST,
whenever that crashed for whatever reason, it
would print cherry bombs on the screen, we calling
bombing out. That was early to mid 90's.
Thanks Again.
Tom
|
|
|
|
|
Not with that signature - you've got a const pointer to a const object - can't call delete on that without casting the pointer...
But even with a reference, you can delete it, like in this (evil, evil) code:
void RobotSpeak(const Robot& robot)
{
Robot* pRobot = const_cast<Robot*>(&robot);
delete pRobot;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Thanks, didn't realize that could be done.
|
|
|
|
|
I would use
void RobotSpeak( const Robot & robot);
with
class Robot
{
public:
void Speak() const
{
std::cout << "Hello\n";
}
};
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]
|
|
|
|
|
I really don't see the point in the standalone RobotSpeak function set. If you have an instance of Robot, say robot, why not just do:
robot.Speak();
And if you have different types of robots saying different things, make Speak virtual and operate through base classes.
The wonderful thing about the Darwin Awards is that everyone wins, especially the members of the audience.
|
|
|
|
|
Tim Craig wrote: I really don't see the point in the standalone RobotSpeak function set. If you have an instance of Robot, say robot, why not just do:
robot.Speak();
And if you have different types of robots saying different things, make Speak virtual and operate through base classes.
I know, but the point of the question wasn't about the Robot speaking, I was asking about using dynamically created objects through references.
|
|
|
|
|
Hi all,
i m using excel automation to read and write excel file.
i want fetch password of excel file.
please tell me how can i fetch password of excel file.
thanks in advance.
|
|
|
|
|
Fetch the password? You supply the password to Excel, you don't (can't?) retrieve it directly...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
|
Hi all,
In a dialog,im having a button.If i move my mouse over that button,I need to open a file.How to find out wther the mouse is over a button.I subclass that CButton class and captured that mouse action over a button using OnMouseMove function.But how can i send this response to parent dialog? Can anyone please help me?
Thanks,
|
|
|
|
|
you could:
1. send a message to the parent CWnd
or
2. pass a pointer to the parent to the button on creation, then call a public member on the parent
|
|
|
|
|
|
How to edit, add, delete these values found in Tools->VC++ Directories?
Чесноков
|
|
|
|
|
|
I meant to add new one e.g. $(MyOwnPath) or change path for available variables e.g. $(ProgramFiles) points to c:\program files to change the path value say to d:\program files
I need to find where these $ values are defined in VS
Чесноков
|
|
|
|
|
Chesnokov Yuriy wrote: I need to find where these $ values are defined in VS
See if this helps.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Chesnokov Yuriy wrote: How to edit, add, delete these values found in Tools->VC++ Directories?
What do you mean? Just click and edit, as you would any other entry.
It's time for a new signature.
|
|
|
|
|
I meant to add new one e.g. $(MyOwnPath) or change path for available variables e.g. $(ProgramFiles) points to c:\program files to change the path value say to d:\program files
I need to find where these $ values are defined in VS
Чесноков
|
|
|
|
|
I'm not sure where these macros are defined but I expect they are setup during install, so are probably somewhere in the registry. As to changing them I have never tried it; if I want extra search items I just add my own paths in the list of directories and adjust the search order as necessary.
It's time for a new signature.
|
|
|
|
|
If you only wish to add to these lists then you can create a new environment variable as follows
clicky[^]
|
|
|
|
|
Hy everyone ! I need to do some conversion , from 'CString' to 'const unsigned char *' into function parameter ... can you help me ?
My definition of function is :
std::string CSmtp::base64_encode(const unsigned char *bytes_to_encode, unsigned int in_len)
{
...
...
}
and I want pass an CString parameter :
std::string encoded_login = base64_encode(m_sLogin,m_sLogin.GetLength());
but it won't compile , and the error is :
error C2664: 'base64_encode' : cannot convert parameter 1 from 'class CString' to 'const unsigned char *'
I try in many ( dummy ) ways , but in vain ...
|
|
|
|
|
just like this:
std::string encoded_login = base64_encode(m_sLogin.GetBuffer(m_sLogin.GetLength()),m_sLogin.GetLength());
|
|
|
|
|
Sorry , don't function :
error C2664: 'base64_encode' : cannot convert parameter 1 from 'char *' to 'const unsigned char *'
modified on Saturday, May 8, 2010 6:16 AM
|
|
|
|
|
Unless the internal buffer of m_sLogin needed changed, why would you suggest using GetBuffer() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|