Click here to Skip to main content
16,020,677 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Localization for languages using XML Pin
CPallini8-May-10 11:17
mveCPallini8-May-10 11:17 
AnswerRe: Localization for languages using XML Pin
Iain Clarke, Warrior Programmer8-May-10 22:24
Iain Clarke, Warrior Programmer8-May-10 22:24 
QuestionRegGetValue / Win32 Pin
Fareed Rizkalla8-May-10 8:25
Fareed Rizkalla8-May-10 8:25 
AnswerRe: RegGetValue / Win32 Pin
Chris Losinger8-May-10 8:50
professionalChris Losinger8-May-10 8:50 
GeneralRe: RegGetValue / Win32 Pin
Fareed Rizkalla8-May-10 8:59
Fareed Rizkalla8-May-10 8:59 
GeneralRe: RegGetValue / Win32 Pin
Kelly Herald8-May-10 9:13
Kelly Herald8-May-10 9:13 
QuestionC++ Pointer Help [Solved] Pin
Tom Moore8-May-10 2:08
Tom Moore8-May-10 2:08 
AnswerRe: C++ Pointer Help Pin
Stuart Dootson8-May-10 3:27
professionalStuart Dootson8-May-10 3:27 
Soo….something like:

Robot* myRobot = new Robot;
RobotSpeak(*myRobot);
?

Oh, and BTW - the calling syntax for RobotSpeak3 would be (*robot)->Speak()

The only parameter passing mechanisms I'd consider using would be those used in RobotSpeak and RobotSpeak4…although I would tend to use a const reference and declare Speak as const if it doesn't modify Robot:

Robot.hpp
#include <iostream>
class Robot{
   public: void Speak() const {std::cout << "Hello\n";} // Use 'const' because the method doesn't alter the Robot instance
};


main.cpp
void RobotSpeak(Robot const & robot) // use a const reference to Robot to indicate the function doesn't modify robot
{
   robot.Speak();
}

int main()
{
   Robot* myRobot = new Robot;
   RobotSpeak(*myRobot);
   return 0;
}


HTH!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

CodeProject MVP for 2010 - who'd'a thunk it!

GeneralRe: C++ Pointer Help Pin
Tom Moore8-May-10 3:37
Tom Moore8-May-10 3:37 
GeneralRe: C++ Pointer Help Pin
Stuart Dootson8-May-10 3:43
professionalStuart Dootson8-May-10 3:43 
GeneralRe: C++ Pointer Help Pin
Tom Moore8-May-10 3:54
Tom Moore8-May-10 3:54 
GeneralRe: C++ Pointer Help Pin
molesworth8-May-10 10:33
molesworth8-May-10 10:33 
GeneralRe: C++ Pointer Help Pin
Tom Moore8-May-10 12:22
Tom Moore8-May-10 12:22 
GeneralRe: C++ Pointer Help Pin
Stuart Dootson9-May-10 21:34
professionalStuart Dootson9-May-10 21:34 
GeneralRe: C++ Pointer Help Pin
Tom Moore10-May-10 2:12
Tom Moore10-May-10 2:12 
AnswerRe: C++ Pointer Help Pin
CPallini8-May-10 3:31
mveCPallini8-May-10 3:31 
AnswerRe: C++ Pointer Help [Solved] Pin
Tim Craig8-May-10 17:04
Tim Craig8-May-10 17:04 
GeneralRe: C++ Pointer Help [Solved] Pin
Tom Moore10-May-10 2:10
Tom Moore10-May-10 2:10 
QuestionHow can fetch Excel File Password by using excel automation? Pin
Le@rner8-May-10 2:06
Le@rner8-May-10 2:06 
AnswerRe: How can fetch Excel File Password by using excel automation? Pin
Stuart Dootson8-May-10 3:28
professionalStuart Dootson8-May-10 3:28 
GeneralRe: How can fetch Excel File Password by using excel automation? Pin
Le@rner9-May-10 18:10
Le@rner9-May-10 18:10 
QuestionMouse over button Pin
Pryabu7-May-10 23:55
Pryabu7-May-10 23:55 
AnswerRe: Mouse over button Pin
Chris Losinger8-May-10 4:13
professionalChris Losinger8-May-10 4:13 
GeneralRe: Mouse over button Pin
Pryabu8-May-10 19:07
Pryabu8-May-10 19:07 
Question$(ProgramFiles) Pin
Chesnokov Yuriy7-May-10 22:30
professionalChesnokov Yuriy7-May-10 22:30 

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.