A class defines a data type, much like a struct would be in C. In a computer science sense, a type consists of both a set of states and a set of operations which transition between those states. Thus int is a type because it has both a set of states and it has operations like i + j or i++, etc. In exactly the same way, a class provides a set of (usually public) operations, and a set of (usually non-public) data bits representing the abstract values that instances of the type can have.
Ok so if I understand this statement, class is a variable that allows user to decide what the function would do. The advantage of class compared to int is that it can represent the abstract values that instances of the type can have.
For example:
class Board
{
// This class encapsulates the chess board, and provides functions
// for making and undoing moves.
In this one the user is compeletely free to define these statements when using class?
If I wanted to say:
class Attacks
{
// If a piece a attacks piece b then piece a needs to move in a straight or diagonal line
Then it would work, or at least this is the basic idea of class (a structure that can store data, the data needs to be implemented correctly of course)