C ++ what we know so far is not substantially different from any other procedural languages. What this language seems especially prominent is the ability to define new user types called classes which introduces the concept of object-oriented programming. In this section we will talk about classes and difference between classes and objects. After that through some examples we will explain how to declare a class, what are data members, how to retrieve object members, what are functional members, what's the meaning of the keyword „key“, what are “inserted functional members”, how to grant access rights, how to form public interface using access rights, what is friend of a class. The next major thing we need to cover are objects how they are constructed or destroyed and more to come.
What is a Class in C++ Program ?
The C++ language imports the major conceptual change in programming which is new type of a data called classes. They are the basis of object oriented programming. The idea for introducing the objects in programming, although revolutionary, it came by analyzing the way the world functions. As you know the object oriented programming came from Palo Alto Research by Xerox Company and was later “stolen” by Steve Jobs and later Bill Gates. If you don’t know check out the computer history on the Youtube.
If we take a look at the data flowing around us, we will come to conclusion that many things can be simply modeled using objects. An object is a name for a set of properties that we can consolidate into a meaningful whole. Rules regulating of which individual object was built and what are its properties are called classes. It is very important to know the difference between classes and objects: the class is just a description while the objects is real, concrete realization made based on class.
Objects exchange information and “asks” each other for favors. The environment of a program doesn’t have to know anything about internal organization of the object. Each object has public interface by which defines his interaction with the environment. The public interface defines which information object can give and in what format. There are also defined all the services that object can give.
Internally object consist of many other objects and interactions between them. The way the representation of the object is accomplished is through the implementation of the object. It is usually hidden from the surroundings in order to secure object consistency. Class consists of public interface and implementation. That unification of public interface and implementation is called encapsulation. When the callas is once defined, we can construct unlimited number of objects which than can be used.
Class-Table of Contents:
- CLASS DECLARATION
- DATA MEMBERS
- MEMBERS THAT RETRIVE OBJECTS
- FUNCTIONAL MEMBERS
- INSERTED FUNCTIONAL MEMBERS
- ASSIGNING ACCESS RIGHTS
- FORMING PUBLIC INTERFACE USING ACCESS RIGHTS
- THE FRIENDS OF THE CLASS
- DECLARATION OF CLASS OBJECTS
- CONSTRUCTON AND DESTRUCTION OF OBJECTS
- THE DEFAULT CONSTRUCTOR
- CONSTRUCTOR CALL DURING OBJECT DEFINITION
- COPY CONSTRUCTOR
- INITIALIZATION REFERENCES AND CONSTANT TERMS
- CONSTRUCTOR AND ACCESS RIGHTS
- GLOBAL AND STATIC OBJECTS
- OBJECT ARRAYS
- CONSTANT FUNCTIONAL MEMBERS
- FUNCTIONAL MEMBERS DECLARED AS VOLATILE
- STATIC CLASS MEMBERS
- STATIC DATA MEMBERS
- STATIC FUNCTIONAL MEMBERS
- CLASS AREA
- CLASS RESOLUTION
- NEASTED CLASSES
- LOCAL CLASSES
- POINTERS ON CLASS MEMBERS
- POINTERS ON DATA MEMBERS
- POINTERS ON FUNCTIONAL MEMBERS
- TEMPORARY OBJECTS
- EXPLICITLY CREATED TEMPORARY OBJECTS
- TEMPORARY OBJECTS WHEN TRANSFERING PARAMETERS IN FUNCTIONS
- TEMPORARY OBJECTS WHEN RETURNING VALUES