User:Zhli

C++ learning tips
reference 
 * Function

void intfrac(float a, float& b, Distance& inch);

reference can be used not only return changed value but also large data structure such as class, array etc. to avoid

inefficient data transmission. actually reference just transmit address of the object.

const int & beta -- transmit address but set as a constant value.

overload 

void func(int a);

void func(Distancd dis);

inline

inine floa lbstokg(float cc)

{ .......}

default parameters

void repchar(char='*', int n=45) float get avg(float new data)
 * Static 

{

static float total=0; // static variables are initialized only once per program.

static int count=0;

count++;

total+=newdata;

return total/count;

}                   int x;
 * Return reference

                  int& setx

{ return x; }

int main

{

setx=92;

cout<<"x="<<x<<endl; //x=92

}