Está en la página 1de 3

C++ Jargon

 C++ contains a standard library that provide input or output (IO)

 istream = input stream
o cin = standard input
o reads data
o G4cin >> xx >> yy;
 ostream = output stream
o cout = standard output
o writes the output
o G4cout << “text” << G4endl;
 Stream is a sequence of characters read from or written to an IO device
 #include “filename” = takes the content of the filename and copies it into source
o contains declarations/library that the code needs to work
o usually used to include C header files so that you can use C functions
o eg. #include<stdio.h> is required to use the C function printf
o EXAMPLE: #include “G4VUserDetectorConstruction.hh” is like a class where
functions can be derived.

 Specification/blueprint/set of instructions of how to provide a service
 Think of class as an object. For example, a camera. A camera takes pictures and
stores them. Like a camera, a class stores something and does something.
 It is a code template or an outline for creating objects, providing initial values for
state and implementations of behavior.
 You are an object of the class 'Human'.
You have functions such as speak, breath etc.
You have data members such as arms, legs, eyes etc.

It derives from the base class 'Mammal', which is an abstract base class which means
there can be no actual instances of it. You cannot get a mammal, it has to be a type of
mammal etc.

 File containing declarations and macro definitions to be shared between several
source files
 Supply definitions and declarations needed to invoke system calls and libraries

 Fragment of a code that has been given a name
 #define
 like a function you can call in the main() code
 does not need repetitive appearance in the main code

char** argcv)  inside the parentheses are parameters needed to pass arguments to main  lets the user specify a set of options to guide the operation of the program  important when you are not ignoring command line arguments  parameters in main represent command line parameters provided to the program when it was started argc  argument count  gives the number of passed arguments when your program is executed argv  argument vector  gives the values of the arguments passed when your program is executed  an array of C-strings  1st element is usually the name of the program .operator  increment operator  adds 1 to the operand  ++1 is equal to i=i+1  --1 is equal to i=i-1 += operator  adds the right hand operand to the left and stores the result in the left operand  a += b is equal to a = a+b == operator  tests whether the left is equal to the right != operator  tests whether the left is not equal to the right #ifdef #endif  checks if the header files have been defined already int main(int argc.ARGUMENT  value passed to a function  refers to the actual value passed to the variable (or parameter)  f(x) = x f(2) =2 x=parameter 2=argument function name()  call operator that causes the function to be invoked  arguments to the function may be passed inside the parentheses ++/-.

*p = &ival.  p hold the address of ival  p is a pointer to ival  2nd statement defines p as a pointer to int and initializes p to point to the int object named ival . “2”. “8”. “4”. “1”. “9”.Example: Gcc mysort.c –o mysort Mysort 2 8 9 1 4 5 Argc = 7 Argv[] = {“mysort”. “5”} Pointer  compound type that points to another type  used for indirect access to other objects  holds the address of another object Example: Int ival =42.