Hi Every body,
1)Can any one help me with the emaning of *the static method of aclass*
I wonder if a class has a dynamic method as well!
My another question is about implementing a code in both the batch mode and the interaction mode.
I have a .cc file(my source file)/after compiling and getting the executable file if I enter (e.g.$G4WORKDIR/bin/Linux-g++/A01app) it goes to the interaction mode, the Idle> prompt appears and I have to enter commands.
Otherwise I can run it via some macro files (in the batch mode)
2)My second question is about
int main(int arg c , char **argv) { ....if (argc!=1) //batch mode
else //interactive mode...........}
I don't undestand how the program distinguish (1)....in the command page I don't enter any number, so how does it know to go for a batch mode or the interactive mode.
Thank you in aadvance for your help
1. You can have static or non-static members. static members apply to all instances of the class.
1 2 3 4 5 6 7
class mylist
{
public:
//...
size_t size() const; // non-static: size of instance
static size_t maxsize(); // ststic: all instances are constrained by this maximum
}
2.
when you run a program with command line arguments, these values come in argc and argv. So lets say you program name is "bbcc".
so if you do this: ./bbcc arg1 arg2 arg3
inside your program, value of argc will be four (guess why) and argv will contains contain all these four values, so the first index will have full path of bbcc, second index will have arg2 and so on.
if you do this: ./bbcc
argc value will be 1 and argv will have only one value at index 0, which is the path of your program.
Edit:
so when argc is not 1, which means user has given all the options and you dont need any interaction. when the value is 1, which means user has not given the options and you will ask for options from the user as the program goes.
[argc value will be 1 and argv will have only one value at index 0, which is the path of your program]
but not this line unfortunately :
[nside your program, value of argc will be four (guess why) and argv will contains contain all these four values, so the first index will have full path of bbcc, second index will have arg2 and so on.]
could you please do me a favor and explain more.
Thank you for your nice help in advance