Introduction OOP Paradigm-

 Introduction OOP Paradigm-

OOP Paradigm-


  •  Object-oriented programming (OOP) is a programming paradigm based upon objects (having both data and methods) that aims to incorporate the advantages of modularity and reusability.
  •  Objects, which are usually instances of classes, are used to interact with one another to design applications and computer programs.

Basic concepts-

=> there are various type of basic concept such as-
1) Class
2) Object
3) Data Abstaraction
4) Polymorhpihsm
5) Encapsulation
6) Inheritance
7) Dynamic Binding
8) Message passing

Benefits and its applications-

Benefits of OOP=>
  •  It is easy to model a real system as real objects are represented by programming objects in OOP. The objects are processed by their  member data and functions. It is easy to analyze the user requirements.
  •  With the help of inheritance, we can reuse the existing class to derive a new class such that the redundant code is eliminated and the use of existing class is extended. This saves time and cost of program.
  •  In OOP, data can be made private to a class such that only member functions of the class can access the data. This principle of data hiding helps the programmer to build a secure program that can not be invaded by code in other part of the program.
  •  With the help of polymorphism, the same function or same operator can be used for different purposes. This helps to manage software complexity easily.
  •  Large problems can be reduced to smaller and more manageable problems. It is easy to partition the work in a project based on objects.
  •  It is possible to have multiple instances of an object to co-exist without any interference i.e. each object has its own separate member data and function.

Basics of C++ -

  •  In this section we will cover the basics of C++, it will include the syntax, variable, operators, loop types, pointers, references and information about other requirements of a C++ program. You will come across lot of terms that you have already studied in C language.

Concept of Structure and Class –

Class-

  •  A class in C++ is a user defined type or data structure declared with keyword class that has data and functions (also called methods) as its members whose access is governed by the three access specifiers private, protected or public (by default access to members of a class is private).
  •  The private members are not accessible outside the class; they can be accessed only through methods of the class. The public members form an interface to the class and are accessible outside the class.

Structure-

  •  Structure is a collection of variables of different data types under a single name. It is similar to a class in that, both holds a collecion of data of different data types.

For example: You want to store some information about a person: his/her name, citizenship number and salary. You can easily create different variables name, citNo, salary to store these information separately.

Private and Public members–

  •  Public- public means everyone is allowed to access.
  •  Private- private means that only members of the same class are allowed to access.

Tokens–

  •  A token is the smallest element of a C++ program that is meaningful to the compiler. The C++ parser recognizes these kinds of tokens: identifiers, keywords, literals, operators, punctuators, and other separators. A stream of these tokens makes up a translation unit.

Data Types–

  •  In computer science and computer programming, a data type or simply type is a classification of data which tells the compiler or interpreter how the programmer intends to use the data.
  • Most programming languages support various types of datafor example: real, integer or Boolean.

Dynamic Initialization–

  •  According to the C/C++ standards global variables should be initialized before entering main(). In the above program, variable 'i' should be initialized by return value of function alpha(). Since the return value is not known until the program is actually executed, this is called dynamic initialization of variable.

Referance Variables–

  •  A reference variable is an alias, that is, another name for an already existing variable. Once a reference is initialized with a variable, either the variable name or the reference name may be used to refer to the variable.

Operators–

  •  An operator is a character that represents an action, as for example x is an arithmetic operator that represents multiplication. In computer programs, one of the most familiar sets ofoperators, the Boolean operators, is used to work with true/false values.

Dynamic Memory Allocation–

  •  C uses malloc() and calloc() function to allocate memory dynamically at run time and uses free() function to free dynamically allocated memory. C++supports these functions and also has two operators new and delete that perform the task of allocating and freeing the memory in a better and easier way.

Manipulators–

  • Manipulators are functions specifically designed to be used in conjunction with the insertion (<<) and extraction (>>) operators on stream objects, for example: cout << boolalpha;... Manipulators are used to change formatting parameters on streams and to insert or extract certain special characters.

Control Structure–

  •  A program is usually not limited to alinear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose, C++ provides control structures that serve to specify what has to be done by our program, when and under which circumstances.


Functions In C++

Post a Comment

Previous Post Next Post