Access-specifier is one of these three c++ keywords:
  
1. Public 
2. Private
3. Protected 

By default, functions and data declared within a class are private to that class and may be accessed only by other members of the class. However, by using public access specifier, you allow functions or data to be accessible to other parts of your program. Once an access specifier has been used, it remains in effect until either another access specifier is encountered or the end of the class declartion is reached.
To switch back to private declarations, you can use the private access specifier. The protected access specifier is needed only when inheritance is involved.

Generally, a class specification has two parts:

A class declaration, which describes the data component in terms of data members, and the public interface, in terms of member functions

The class method definitions, which describes how certain class member functions are implemented

Roughly speaking, the class declaration provides a class overview, whereas the method definitions supply the details.

The class specifies the type and scope of its member. The keyword class indicates that the name, which follows (ClassName), is an abstract data type. The body of a class is enclosed within the curly braces followed by a semicolon – the end of a class specification. The body of a class contains declaration of variables and functions, collectively known as members. The variables declared inside a class grouped under two sections, private and public, which define the visibility of members.

The private members are accessible only to their own class’s members. On the other hand, public members are not only accessible to their own members, but also from outside the class. The members in the beginning of class without any access specifier are private by default. Hence, the first use of the keyword private in a class is optional. A class, which is totally private, is hidden from the external world and will not serve any useful purpose.

The following declaration illustrates the specification of a class called student having roll_no and name as its data members:

Class student
int roll_no;
 char name[20];
 public :
 void setdata(int roll_no_in,char *name_in) 
{
  roll_no=roll_no_in;
  strcpy(name,name_in);
 }
 void outdata() 
{
 cout << “Roll No = “ << roll_no<<endl;
 cout << “Name = “ << name << endl;
}
};

A class should be given some meaningful name, (for instance, student) reflecting the information it holds. The class name student becomes a new data type identifier, which satisfies the properties of abstraction; it can be used to define instances of class data type. The class student contains two data members and two member functions. The data members are private by default while both the member functions are specified as public. The member function setdata() can be used to assign values to the data members roll_no and name. The member function outdata() can be used for displaying the value of data members. The data members of the class student cannot be accessed by any other function except member functions of the student class. It is a general practice to declare data member as private and member function as public.