In algebra, what is the formal defition of a class function? I know that a class function is a function on a group $G$ that is constant on the conjugacy classes of $G.$  If my understanding is correct, this means that if a group has, say, $5$ conjugacy classes, the class function $\alpha$ on this group will take on $5$ distinct values.  However, what I'm not clear about is where these values would lie.  Would they be complex numbers or something else?  
Also, can somebody provide a simple example of a class function for some elementary group?  
Thank you.    
 A: The values of a class function lie in a set of your choice. Some choices are particularly useful in helping to analyse groups - characters of representations are class functions.
To take a couple of non-trivial examples, on the symmetric group the function which is $1$ on even permutations and $-1$ on odd permutations is a class function.
In a cyclic group of order $n$ written multiplicatively with generator $a$, if $z$ is a complex number with $z^n=1$ then the function which takes $a^r\to z^r$ is a class function. 
In the abelian case, like this, the fact that this is a class function is somewhat redundant (all the classes have size $1$ anyway), but the fact that these functions, which turn out to be the characters of the group, form a basis for the space of class functions with values in the complex numbers is highly significant. The orthogonality properties of the characters and the periodicity modulo $n$, for example, are features of Dirichlet's proof about primes in arithmetic progression.
The characters of the symmetric groups are class functions and are all rational integers $\in \mathbb Z$. Since you reference representation theory, you might be interested in the function on the symmetric group on three elements (order $6$) which takes the value $2$ on the identity, $0$ on the transpositions and $-1$ on the elements of order $3$.
In more advanced work, to give a further example, the characters (which are algebraic integers in the context of $\mathbb C$) are computed in relation to p-adic fields and integers.
