|
the learning curve for STL is steep; once you get the grip of it, it's a ton'o'fun.
|
|
|
|
|
It doesn't have to be that complicated. Consider this example:
-----------
#include <iostream>
#include <vector>
#include <algorithm>
void PrintInt(int num)
{
using namespace std;
cout << num << " ";
}
void main()
{
using namespace std;
vector<int> Values;
for (int i=1; i<=10; ++i)
{
Values.push_back(i);
}
for_each(Values.begin(), Values.end(), PrintInt);
cout << endl;
}
Steve
|
|
|
|
|
In the .H file, the member function is defined as:
ToggleFreezeRequest(const int i = -1);
In the .CPP file, the member function is:
void CSystemControlData::ToggleFreezeRequest(const int value)
{
.
.
.
}
When this member function is being called, it is thus:
sysCtrl.ToggleFreezeRequest();
I'm confused as to what is actually happening here. What is actually happening when the member function is called from somewhere in the code? Does the parameter ever change from being set to -1?
Thanks for helping to "de-confuse" me on this.
John P.
|
|
|
|
|
The function has a default parameter, i.e. if it's called without specifying the parameter (e.g. ToggleFreezeRequest() ) then
the the value of the parameter will be the default one (-1 ). On the other hand, if you call it passing the actual value (e.g. ToggleFreezeRequest(6) or ToggleFreezeRequest(n) ) then the default value it's overidden by the passed one.
Moreover, the formal parameter it is declared as a const , meaning that the function cannot change the value passed.
|
|
|
|
|
jparken wrote: What is actually happening when the member function is called from somewhere in the code?
i is assigned a value of -1 if no argument is supplied. It's called the default argument.
jparken wrote: Does the parameter ever change from being set to -1?
Yes, if another argument is supplied.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Thank you, gentlemen. That makes it all clear. Much obliged.
John P.
|
|
|
|
|
It means ToggleFreezeRequest() takes an int parameter called i , and if the calling code doesn't specify a parameter, i is set to -1 by default. All the const means is that i can't be changed in ToggleFreezeRequest() .
|
|
|
|
|
I'm beginner. I want to create a text box ,where I cant input text in box ,box = rectangle is created by moving mouse. Thank a lot!
|
|
|
|
|
you want to create an editbox
|
|
|
|
|
bosstroy wrote: I'm beginner.
Are you sure you didn't mean to say infant? You asked this question less than 24 hours ago here[^]. Perhaps you should go and read the suggestions you were given and actually try coding something.
|
|
|
|
|
WalderMort wrote: Are you sure you didn't mean to say infant
Some people have a memory and an attention span, you should try them out one day. - Jeremy Falcon
|
|
|
|
|
WalderMort wrote: Are you sure you didn't mean to say infant?
AFAIK, all of us are beginner here [ ] if you sure, then i have to wear nappies
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
I've installed Visual Studio 2005 since few days and in trying to perform projects porting from Visual Studio 6.0.
I've always worked with Visual Studio 6.0 since now.
In Visual Studio 2005 I can't find something like MFC Class Wizard present in Visual Studio 6.0. Is there a tool in Visual Studio 2005 to be used to map windows messages and events, to add DDX variables, and all other things I can do with MFC Class Wizard in Visual Studio 6.0 directly with the sinple right click of the mouse ?
Thanks a lot !
|
|
|
|
|
To add members just right click the class and use the popup menu. Events are in the "Properties" view.
led mike
|
|
|
|
|
ilgale wrote: In Visual Studio 2005 I can't find something like MFC Class Wizard present in Visual Studio 6.0.
Seehere.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I'd like to manage a "home made" data base completely in flat 'C. To be clear, not using (or interfacing with) any DBMS like ORACLE, MySQL, etc. .
The only functions I need are : Create an index, seek (according to a specific index), go to the first, last, next, previous record.
I do NOT need any kind of "query" manipulation (I will do it all programmatically).
What I'd like: a very light weigth library which I can call in flat 'C, free (if possible) or low cost (else).
hummm - nothing is better than an all dressed pizza
|
|
|
|
|
What the hell is "flat C"?
If you mean you have access to only some old C compiler and not a C++ compiler you might just say so.
Either way C or C++ what you describe is just fundamental operations like file IO and sorting so why do you need some library to do this?
led mike
|
|
|
|
|
led mike wrote: What the hell is "flat C"?
C Flat - also known as "B" (in music) - the predecessor to C
|
|
|
|
|
ROTFL, that one was good !
|
|
|
|
|
Mark Salsbery wrote: C Flat - also known as "B" (in music) - the predecessor to C
Does that mean that C# is really just D? Why didn't Microsoft keep the syntax the same as D then!?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: Does that mean that C# is really just D?
Oh no...C# was definitely the logical sequel to C.
Zac Howland wrote: Why didn't Microsoft keep the syntax the same as D then!?
You're kidding, right?
|
|
|
|
|
Mark Salsbery wrote: You're kidding, right?
Only partially. D, D+, and D++ have been around for a while.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
Hello world for D.
D Language
My D++ link is dead. I appears that its features were merged back into D. I've never used either language, but I did run across them a couple years ago while doing some research for a company I use to work for.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Cool I had no idea. Thanks for the links!
|
|
|
|