by Muskan-1
by Muskan-1
by Muskan-1
DEVELOPMENT
By:
Muskan Jain
Roll no :1221256
Branch : Computer Science
Engineering
1
WHY WE SHOULD STUDY C++
2
C++, as the name suggests, is a superset of C. As a matter
of fact, C++ can run most of C code while C cannot run C+
+ code
FUNCTIONS
Function is a sub program which performs logically isolated
task
Creation of function is must for easy readability & easy
maintenance of program
4
What is Procedural Programming? [Definition]
Procedural Programming may be the first programming paradigm that
a new developer will learn. Fundamentally, the procedural code is the
one that directly instructs a device on how to finish a task in logical
steps Procedural Programming divides the program into procedures,
which are also known as routines or functions, simply containing a
series of steps to be carried out.
OBJECT ORIENTED PROGRAMMING
OOP took the best ideas of structured program & combine them
with several new concepts.
6
STRIKING FEATURES OF OOP
Programs are divided into what are known as objects.
Data is hidden & cannot be accessed by external functions.
7
EXAMPLE
In any company one has to deal with number of entities at a time
such as:
Employees [25 functions]
Customers [20 functions]
Vendors [15 functions]
Sales [10 functions]
Purchases [20 functions]
Therefore total of 90 functions, which are supposed to be
designed.
If we use C, we will have to form all the different sub programs
for all the 90 functions.
This drawback is removed by OOP approach (in SPA, there is
great redundancy).
8
OOPS FEATURES ?
Class
Object
Encapsulation
Abstraction
Polymorphism
Inheritance
9
CLASS ?
Classes are user-defined (programmer-defined) types.
A class is a collection of objects that have identical properties,
common behaviour and shared relationship.
Once the class is defined any number of objects of that class is
created.
For example planets, sun and moon are the members of the
solar system class.
10
A Class : is a way to bind the data and its associated functions
together. All the elements of a class are private by default, even
elements can be declared as public or protected. An object is an
instance of a class.
Syntax:
class class-name
{
access:specifier
private data and functions
}
In the above syntax the every class has a unique name, the
"access:specifier" can either private, public, protected. The
"protected" is used when inhertinace is applied.
OBJECT Objects are the basic runtime entities in an object-oriented
system. They may represent a person, a place, a bank
account, a table of data or any item that the program has to
handle.
Fruits
12
Object Class
Teacher : Faculty
Table : furniture
Bikes : Vehicle
13
3. ENCAPSULATION
Wrapping of data and functions together as a single unit is
known as encapsulation. By default data is not accessible to
outside world and they are only accessible through the
functions which are wrapped in a class.
int main () {
first_function::func();
second_function::func();
return 0;
}
HEADER FILES
Header files contain definitions of Functions and
Variables, which is imported or used into any C++
program by using the pre-processor #include statement.
Header file have an extension ".h" which contains C++
function declaration and macro definition.
Each header file contains information (or declarations) for a particular group
of functions. Like stdio.h header file contains declarations of standard input
and output functions available in C++ which is used for get the input and
print the output. Similarly, the header file math.h contains declarations of
mathematical functions available in C++.
Types of Header Files in C++
System header files: It is comes with compiler.
User header files: It is written by programmer.
Why need of header files