SlideShare a Scribd company logo
Human resources slide 1
Placement
Training
Presented By :-
VARSHA YADUVANSHI Corporate Trainer
AGENDA
First C++ Program, cout / cin
Datatypes
Operators
Control flow statements
Human resources slide 2
Human resources slide 3
Introduction to C++
Placement
Training
Human resources slide 3
Phase-1:Creating a Program
Type a C++ program(typically referred to as Source code)
using an editor(Like TurboC++ ,Dev C++ , code blocks , Visual
studio, etc).
Online editor like:- Code chef , etc
And save C++ source code file names with extensions
like .cpp which indicates that a file contains C++ source
code.
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Why using namespace std ?
Namespace:-
Namespace is a declarative region that provide a scope to
the identifiers to avoid naming collisions in a program.
Demo: Need
int main()
{
int num=10;
float num=20; // Error--> two variables with same
name in same scope not allowed
cout<<"Value of Num:"<<num<<endl;
}
Human resources slide 3
Placement
Training
Introduction to C++
What are cout and cin?
 In C, console input/output is achieved using printf() and
scanf() functions.
 C++ supports an object oriented I/O system in the form
of streams.
 Stream:- Stream refers to the flow of data from a
particular source to a specified destination.
 In C++, classes representing each stream.
Human resources slide 3
Placement
Training
Introduction to C++
What are cout and cin?
Stream
class
istream
class
ostream
class
Human resources slide 3
Placement
Training
Introduction to C++
What are cout and cin?
Cout:- It is a pre-defined object of ostream class.
It represents output stream.
It is used to display output on the screen using Extraction
operator(<<).
Syntax:- cout<<num;
cin:- It is a pre-defined object of istream class.
It represents input stream.
It is used to take input from keyboard and store it in a
variable using Insertion operator(>>).
Syntax:- cin>>num;
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Demo of First C++ Program
Human resources slide 3
Placement
Training
Introduction to C++
Human resources slide 3
Placement
Training
Introduction to C++
Keywords:- Keywords are the reserved words.
They have some predefined meanings in C++.
Human resources slide 3
Placement
Training
Introduction to C++
 Identifiers:- Identifiers are the fundamental building
blocks of program.
 And used for the names given to variable, function , data
definition.
 Rules of Naming Identifier:-
 Identifiers can have alphabet , digits , underscore sign.
Ex:- int stud_Id;
 They must not be a keyword or Boolean.
 Ex:- int if; // Not allowed
 They can be of any length.
Human resources slide 3
Placement
Training
Introduction to C++
Rules of Naming Identifier:-
They must not begin with a digit.
Ex:- int Num1; // Allowed
Special characters not allowed.
Ex1:- int emp_Id; // Allowed
Ex2:- int emp#Id; // NotAllowed
C++ is a case sensitive language.(Upper,lower,camelcase)
Ex1: int Num; // All are different
Ex2:- int num;
Ex3:- int NUM;
Human resources slide 3
Placement
Training
Introduction to C++
 Constants:- Constants are the identifiers whose value can
not be changed during program execution.
 Constants are used to represent fixed values.
 Also, known as Literals.
 const keyword is used to make a constant value.
 Syntax:- const int Pie=3.1412;
Human resources slide 3
Placement
Training
Introduction to C++
Variable:-
Variable is a name given to memory location allocated by the
compiler to store different values .
Variables are used in c++ , where we need storage for any
value, which will change in program.
Example:- int empId = 101; // Declared and initialized
variable of integer type.
RAM
Memory location named empID
101
Human resources slide 3
Placement
Training
Introduction to C++
Demo on variable
Human resources slide 10
Thank You
Varsha Yaduvanshi
Human resources slide 3
Different Programming Paradigm
Programming:-Programming is giving instructions to the
computer in a language that it understands.
Instructions:- It is a combination of some words that must be
given in a proper sequence to get desired output.
Placement
Training
Human resources slide 4
Placement
Training
Human resources slide 4
Placement
Training
Introduction to C++
 What is C++ ?
 History of C++?
 Why C++?
 Benefits of C++?
 C++ over C
Human resources slide 4
Placement
Training
Introduction to C++
What is C++?
• C++ is a powerful , efficient and general-purpose
programming language based on C.
• It was developed by “Bjarne Stroustrup” in 1979.
• Many of today from GUI applications to 3D graphics for
games to real-time mathematical simulations.
• Software development in C and C++ continues to offer
benefits for enterprises around the world, based on their
business objectives.
• Learning C++ is a wise investment for all
programmers.
Human resources slide 4
Placement
Training
Introduction to C++
Human resources slide 4
Placement
Training
Introduction to C++
History of C++
• The origin of C++ to 1979 by “ Mr. Bjarne Stroustrup ” who
was an employee of Bell AT and T Laboratory started working
on language “C with Classes”.
• In 1983 it was named to C++.
• During 1989- 1990 , a joint ANSI and ISO
committee standardize C++ language.
• “Alexander Stephanou” added extra features like
STL, Template, RTTI, etc.
• Later, C++11, C++14 ,C++17,C++23 versions of C++ was
released with additional features.
Human resources slide 4
Placement
Training
Introduction to C++
Why C++?
Following reasons why you should learn C++.....
• C++ is irreplaceable.
• It is sure to expand your knowledge on the Internal
architecture of the computer.
• 60% Stack Overflow Answer rate and active
community.
• C++ job opportunities and salary.
• C++ developers can expect an average of monthly
Rs.30000.
• Salary with over 7,700 jobs advertised every month.
Human resources slide 4
Placement
Training
Introduction to C++
Benefits of C++?
• C++ is highly Portable, efficient , powerful and fast
P.L.
• It is used for multi device, multi platform app
development.
• C++ is an Object Oriented P.L. include concepts like
Class, Objects, Abstraction, Encapsulation, Inheritance,
Polymorphism , etc.
Human resources slide 4
Placement
Training
Introduction to C++
Benefits of C++?
• OOP concepts allowed code reusability and makes
program very maintainable.
• C++ has a very big job market as it is used in various
industries like:- Finance, Games, App development , etc.
• It has rich function library.
• Modularity.
Human resources slide 4
Placement
Training
Introduction to C++
Human resources slide 4
Placement
Training
Introduction to C++
Human resources slide 4
Placement
Training
Introduction to C++
Human resources slide 4
Placement
Training
Introduction to C++
Human resources slide 4
Placement
Training
Introduction to C++
• Object Oriented Programming is a programming
style based on the concept of objects which are data
structures that contain Data and Code.
• Data:- In the form of field known as Attributes.
• Ex:- student object
• Attributes are:- studID , studName , studBranch , etc.
• Code in the form of procedures known as
Methods/Functions.
• Ex:- studSpMarks(), studSubMarks().
Human resources slide 4
Placement
Training
Introduction to C++
Human resources slide 4
Placement
Training
Introduction to C++
Objects:-
Everything in this world is an object from a Nail to
Hammer and Liver to Rocket.
• From human perspective an object is a tangible
thing that exist in time and space.
• An object represents an individual item , unit or
entity with a well-defined structure and behavior.
• Ex:- A car, a person, a training course , bank
account , etc.
Human resources slide 4
Placement
Training
Introduction to C++
Characteristics of an Object:-
1) State. 2) Behavior. 3) Identity. 4) Responsibility.
1. State: It represents the current value of an
attribute.
Types of state:- i)Static state .(ii)Dynamic state.
i) Static state:- Like- Id, Name , Gender , etc.
ii) Dynamic state:- Like- Age, Mobile number.
Human resources slide 4
Placement
Training
Introduction to C++
Characteristics of an Object:-
2) Behavior:- How an object act or react.
Ex:-A Faculty object : behavior is taking lectures.
3) Identity:- It distinguish one object to another.
It provide uniqueness.
Ex:- Emp_Id = 101 , Stud_Id = s01, etc.
4) Responsibility:- The role it serves.
Ex:- A Faculty object : To do allotted work(4Lectures).
Human resources slide 4
Placement
Training
Introduction to C++
Class:-
Why class?
• The main purpose of C++ programming is to add object
orientation to the C programming language .
• Classes are the central feature of C++ that supports
object-oriented programming and are often called
user-defined types.
What is class?
1). Class can be compared to a template or Mold out
of which similar kind of objects are created.
Human resources slide 4
Placement
Training
Introduction to C++
Class:-
2)A class is like a blueprint for an object.
3)It combines data representation and
methods/Functions for manipulating that data
into one neat package.
4)The data(variables) and functions (methods) within
a class are called members of the class.
Human resources slide 4
Placement
Training
Introduction to C++
Class:-
2)A class is a user defined data type that
has data and functions as a member.
Example: Student class and studId , studName
are the data members .
Studmarks(), studResult(), are the member
functions(properties) .[s1,s2,s3 are the same
kind of objects]
Human resources slide 4
Placement
Training
Introduction to C++
Class:-
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
1)Abstraction. 2) Encapsulation.
3) Inheritance. 4) Polymorphism.
1) Abstraction:- Data abstraction is one of the most
essential and important feature of object-
oriented programming.
• Data abstraction refers to providing only essential
information about the data to the outside world,
hiding the background details or implementation.
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
Abstraction : (Ex:- Car, Coffee machine, ATM , etc.)
Real life ex:- Consider a real-life example of a man
driving a car.
The man only knows that pressing the accelerators will
increase the speed of car or applying brakes will stop
the car .
But he does not know about how on pressing
accelerator the speed is increasing,
He does not know about the inner mechanism of the
car or the implementation of accelerator, brakes etc. in
the car. This is what abstraction is.
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
• Abstraction in programming: We can implement
Abstraction in programming using classes.
• Class helps us to group data members and
member functions using available
access specifiers .
• A Class can decide which data member will be visible
to outside world and which is not.
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
• Advantages of Data Abstraction:
• Helps the user to avoid writing the low-level code
• Avoids code duplication and increases reusability.
• Can change internal implementation of class
independently without affecting the user.
• Helps to increase security of an application or program as
only important details are provided to the user.
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
2) Encapsulation:- In OOP, Encapsulation is defined as the
data and the functions binding together in a single unit
(class) that manipulates them.
Real life Ex: In a company there are different sections
like the accounts section, finance section, sales section
etc.
The finance section handles all the financial transactions
and keep records of all the data related to finance ,
similarly other department handles.
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
2) Encapsulation Real life Ex:-
• Now there may arise a situation when for some reason
an official from finance section needs all the data about
sales in a particular month.
• In this case, he is not allowed to directly access the data
of sales section. He will first have to contact some other
officer in the sales section and then request him to give
the data.
• This is what encapsulation is. Here the data of sales
section and the employees that can manipulate them
are wrapped under a single name “sales section”.
Human resources slide 4
Placement
Training
Introduction to C++
Human resources slide 4
Placement
Training
Introduction to C++
Encapsulation Program:- Thus, we can say that here, the
variable x and the functions get() and set() are bind
together which is nothing but encapsulation.
• As using encapsulation also hides the data. In the above
example the data of any of the section like sales, finance
or accounts is hidden from any other section.
• In C++ encapsulation can be implemented using Class
and access modifiers.
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
3) Inheritance:- Inheritance is one of the most important
feature of Object-Oriented Programming.
 The capability of a class to derive properties and
characteristics from another class is
called Inheritance.
 Sub Class: The class that inherits properties from another
class is called Sub class or Derived Class.
 Super Class: The class whose properties are inherited by
sub class is called Base Class or Super class.
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
• 3) Inheritance Examples[Vehicles, shapes,
fruits,Employee]
• Consider a group of vehicles.
• You need to create classes for Bus, Car and
Truck.
• The methods fuelAmount(), capacity(), applyBrakes()
will be same for all the three classes.
• If we create these classes avoiding inheritance, then we
must write all these functions in each of the three classes
as shown in below figure:
Human resources slide 4
Placement
Training
Introduction to C++
Example of Inheritance
Human resources slide 4
Placement
Training
Introduction to C++
Example of Inheritance
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
4)Polymorphism:-It is one of the most imp feature of OOP.
The word Polymorphism means Many forms.
Polymorphism = Poly + Morph
(Many)
(Forms)
Definition: We can define polymorphism, as the ability of
a message to be displayed in more than one form.
Example:- Consider an electricity, passed to different
objects like Light , Fan , Laptop, Desktop , etc.
Human resources slide 4
Placement
Training
Introduction to C++
Polymorphism Example: A Boy
Human resources slide 4
Placement
Training
Introduction to C++
Polymorphism Example: Shape class
Human resources slide 4
Placement
Training
Introduction to C++
Types of Polymorphism
Human resources slide 4
Placement
Training
Introduction to C++
OOP Concepts:-
4)Polymorphism:-
Advantages of Polymorphism:
1) Generic code
2) Extensibility
3) Code sharing
4) Reduction in complexity
Disadvantages of Polymorphism:
1) Just by looking at the source code, it is not possible to
determine which code is executed.
Human resources slide 10
Thank You
Varsha Yaduvanshi

More Related Content

PPTX
Introduction to Software and Programming
PDF
C & C++ Training Institutes in Bangalore
PPT
c++ ppt.ppt
PPTX
Basics of c++ Programming Language
PDF
Object Oriented Programming With C Sharma A K
PPTX
lecture NOTES ON OOPS C++ ON CLASS AND OBJECTS
PPT
lecture02-cpp.ppt
PPT
lecture02-cpp.ppt
Introduction to Software and Programming
C & C++ Training Institutes in Bangalore
c++ ppt.ppt
Basics of c++ Programming Language
Object Oriented Programming With C Sharma A K
lecture NOTES ON OOPS C++ ON CLASS AND OBJECTS
lecture02-cpp.ppt
lecture02-cpp.ppt

Similar to Introduction to CPP programming and its benefits (20)

PPT
lecture02-cpp.ppt
PPT
lecture02-cpp.ppt
PPT
lecture02-cpp.ppt
PPTX
Lesson 1 - Introduction to C++ Language.pptx
PPT
C++ - A powerful and system level language
PDF
C 20 for Programmers 3rd Edition P. Deitel
PPTX
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
PPTX
C++ Introduction brown bag
PPTX
#Code2 create c++ for beginners
PPTX
CSC2161Programming_in_Cpp_Lecture4-OOP Classes and Objects[1].pptx
PPTX
Session 1 - c++ intro
PDF
C 20 for Programmers 3rd Edition P. Deitel
PDF
C 20 for Programmers 3rd Edition P. Deitel
PDF
From Novice To Ninja Mastering Dsa In C Pabitra Banerjee
PDF
C 20 for Programmers 3rd Edition Harvey Deitel
PPTX
C++ programming Assignment Help
PDF
Get C 20 for Programmers 3rd Edition P. Deitel free all chapters
PPTX
computer ppt group22222222222222222222 (1).pptx
PDF
Computer Programming With C Kunal Pimparkhede
PPT
Basics of c++ Programming Language
lecture02-cpp.ppt
lecture02-cpp.ppt
lecture02-cpp.ppt
Lesson 1 - Introduction to C++ Language.pptx
C++ - A powerful and system level language
C 20 for Programmers 3rd Edition P. Deitel
UNIT - 1- Ood ddnwkjfnewcsdkjnjkfnskfn.pptx
C++ Introduction brown bag
#Code2 create c++ for beginners
CSC2161Programming_in_Cpp_Lecture4-OOP Classes and Objects[1].pptx
Session 1 - c++ intro
C 20 for Programmers 3rd Edition P. Deitel
C 20 for Programmers 3rd Edition P. Deitel
From Novice To Ninja Mastering Dsa In C Pabitra Banerjee
C 20 for Programmers 3rd Edition Harvey Deitel
C++ programming Assignment Help
Get C 20 for Programmers 3rd Edition P. Deitel free all chapters
computer ppt group22222222222222222222 (1).pptx
Computer Programming With C Kunal Pimparkhede
Basics of c++ Programming Language
Ad

Recently uploaded (20)

PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
DOCX
573137875-Attendance-Management-System-original
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Construction Project Organization Group 2.pptx
PPTX
web development for engineering and engineering
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
PPT on Performance Review to get promotions
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PPTX
Current and future trends in Computer Vision.pptx
PDF
composite construction of structures.pdf
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
additive manufacturing of ss316l using mig welding
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
573137875-Attendance-Management-System-original
Internet of Things (IOT) - A guide to understanding
Construction Project Organization Group 2.pptx
web development for engineering and engineering
bas. eng. economics group 4 presentation 1.pptx
PPT on Performance Review to get promotions
Automation-in-Manufacturing-Chapter-Introduction.pdf
Safety Seminar civil to be ensured for safe working.
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Current and future trends in Computer Vision.pptx
composite construction of structures.pdf
Lecture Notes Electrical Wiring System Components
Model Code of Practice - Construction Work - 21102022 .pdf
Foundation to blockchain - A guide to Blockchain Tech
additive manufacturing of ss316l using mig welding
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Ad

Introduction to CPP programming and its benefits

  • 1. Human resources slide 1 Placement Training Presented By :- VARSHA YADUVANSHI Corporate Trainer
  • 2. AGENDA First C++ Program, cout / cin Datatypes Operators Control flow statements Human resources slide 2
  • 3. Human resources slide 3 Introduction to C++ Placement Training
  • 4. Human resources slide 3 Phase-1:Creating a Program Type a C++ program(typically referred to as Source code) using an editor(Like TurboC++ ,Dev C++ , code blocks , Visual studio, etc). Online editor like:- Code chef , etc And save C++ source code file names with extensions like .cpp which indicates that a file contains C++ source code. Placement Training Introduction to C++
  • 5. Human resources slide 3 Placement Training Introduction to C++
  • 6. Human resources slide 3 Placement Training Introduction to C++
  • 7. Human resources slide 3 Placement Training Introduction to C++
  • 8. Human resources slide 3 Placement Training Introduction to C++
  • 9. Human resources slide 3 Placement Training Introduction to C++
  • 10. Human resources slide 3 Placement Training Introduction to C++
  • 11. Human resources slide 3 Placement Training Introduction to C++
  • 12. Human resources slide 3 Placement Training Introduction to C++ Why using namespace std ? Namespace:- Namespace is a declarative region that provide a scope to the identifiers to avoid naming collisions in a program. Demo: Need int main() { int num=10; float num=20; // Error--> two variables with same name in same scope not allowed cout<<"Value of Num:"<<num<<endl; }
  • 13. Human resources slide 3 Placement Training Introduction to C++ What are cout and cin?  In C, console input/output is achieved using printf() and scanf() functions.  C++ supports an object oriented I/O system in the form of streams.  Stream:- Stream refers to the flow of data from a particular source to a specified destination.  In C++, classes representing each stream.
  • 14. Human resources slide 3 Placement Training Introduction to C++ What are cout and cin? Stream class istream class ostream class
  • 15. Human resources slide 3 Placement Training Introduction to C++ What are cout and cin? Cout:- It is a pre-defined object of ostream class. It represents output stream. It is used to display output on the screen using Extraction operator(<<). Syntax:- cout<<num; cin:- It is a pre-defined object of istream class. It represents input stream. It is used to take input from keyboard and store it in a variable using Insertion operator(>>). Syntax:- cin>>num;
  • 16. Human resources slide 3 Placement Training Introduction to C++
  • 17. Human resources slide 3 Placement Training Introduction to C++
  • 18. Human resources slide 3 Placement Training Introduction to C++
  • 19. Human resources slide 3 Placement Training Introduction to C++ Demo of First C++ Program
  • 20. Human resources slide 3 Placement Training Introduction to C++
  • 21. Human resources slide 3 Placement Training Introduction to C++ Keywords:- Keywords are the reserved words. They have some predefined meanings in C++.
  • 22. Human resources slide 3 Placement Training Introduction to C++  Identifiers:- Identifiers are the fundamental building blocks of program.  And used for the names given to variable, function , data definition.  Rules of Naming Identifier:-  Identifiers can have alphabet , digits , underscore sign. Ex:- int stud_Id;  They must not be a keyword or Boolean.  Ex:- int if; // Not allowed  They can be of any length.
  • 23. Human resources slide 3 Placement Training Introduction to C++ Rules of Naming Identifier:- They must not begin with a digit. Ex:- int Num1; // Allowed Special characters not allowed. Ex1:- int emp_Id; // Allowed Ex2:- int emp#Id; // NotAllowed C++ is a case sensitive language.(Upper,lower,camelcase) Ex1: int Num; // All are different Ex2:- int num; Ex3:- int NUM;
  • 24. Human resources slide 3 Placement Training Introduction to C++  Constants:- Constants are the identifiers whose value can not be changed during program execution.  Constants are used to represent fixed values.  Also, known as Literals.  const keyword is used to make a constant value.  Syntax:- const int Pie=3.1412;
  • 25. Human resources slide 3 Placement Training Introduction to C++ Variable:- Variable is a name given to memory location allocated by the compiler to store different values . Variables are used in c++ , where we need storage for any value, which will change in program. Example:- int empId = 101; // Declared and initialized variable of integer type. RAM Memory location named empID 101
  • 26. Human resources slide 3 Placement Training Introduction to C++ Demo on variable
  • 27. Human resources slide 10 Thank You Varsha Yaduvanshi
  • 28. Human resources slide 3 Different Programming Paradigm Programming:-Programming is giving instructions to the computer in a language that it understands. Instructions:- It is a combination of some words that must be given in a proper sequence to get desired output. Placement Training
  • 29. Human resources slide 4 Placement Training
  • 30. Human resources slide 4 Placement Training Introduction to C++  What is C++ ?  History of C++?  Why C++?  Benefits of C++?  C++ over C
  • 31. Human resources slide 4 Placement Training Introduction to C++ What is C++? • C++ is a powerful , efficient and general-purpose programming language based on C. • It was developed by “Bjarne Stroustrup” in 1979. • Many of today from GUI applications to 3D graphics for games to real-time mathematical simulations. • Software development in C and C++ continues to offer benefits for enterprises around the world, based on their business objectives. • Learning C++ is a wise investment for all programmers.
  • 32. Human resources slide 4 Placement Training Introduction to C++
  • 33. Human resources slide 4 Placement Training Introduction to C++ History of C++ • The origin of C++ to 1979 by “ Mr. Bjarne Stroustrup ” who was an employee of Bell AT and T Laboratory started working on language “C with Classes”. • In 1983 it was named to C++. • During 1989- 1990 , a joint ANSI and ISO committee standardize C++ language. • “Alexander Stephanou” added extra features like STL, Template, RTTI, etc. • Later, C++11, C++14 ,C++17,C++23 versions of C++ was released with additional features.
  • 34. Human resources slide 4 Placement Training Introduction to C++ Why C++? Following reasons why you should learn C++..... • C++ is irreplaceable. • It is sure to expand your knowledge on the Internal architecture of the computer. • 60% Stack Overflow Answer rate and active community. • C++ job opportunities and salary. • C++ developers can expect an average of monthly Rs.30000. • Salary with over 7,700 jobs advertised every month.
  • 35. Human resources slide 4 Placement Training Introduction to C++ Benefits of C++? • C++ is highly Portable, efficient , powerful and fast P.L. • It is used for multi device, multi platform app development. • C++ is an Object Oriented P.L. include concepts like Class, Objects, Abstraction, Encapsulation, Inheritance, Polymorphism , etc.
  • 36. Human resources slide 4 Placement Training Introduction to C++ Benefits of C++? • OOP concepts allowed code reusability and makes program very maintainable. • C++ has a very big job market as it is used in various industries like:- Finance, Games, App development , etc. • It has rich function library. • Modularity.
  • 37. Human resources slide 4 Placement Training Introduction to C++
  • 38. Human resources slide 4 Placement Training Introduction to C++
  • 39. Human resources slide 4 Placement Training Introduction to C++
  • 40. Human resources slide 4 Placement Training Introduction to C++
  • 41. Human resources slide 4 Placement Training Introduction to C++ • Object Oriented Programming is a programming style based on the concept of objects which are data structures that contain Data and Code. • Data:- In the form of field known as Attributes. • Ex:- student object • Attributes are:- studID , studName , studBranch , etc. • Code in the form of procedures known as Methods/Functions. • Ex:- studSpMarks(), studSubMarks().
  • 42. Human resources slide 4 Placement Training Introduction to C++
  • 43. Human resources slide 4 Placement Training Introduction to C++ Objects:- Everything in this world is an object from a Nail to Hammer and Liver to Rocket. • From human perspective an object is a tangible thing that exist in time and space. • An object represents an individual item , unit or entity with a well-defined structure and behavior. • Ex:- A car, a person, a training course , bank account , etc.
  • 44. Human resources slide 4 Placement Training Introduction to C++ Characteristics of an Object:- 1) State. 2) Behavior. 3) Identity. 4) Responsibility. 1. State: It represents the current value of an attribute. Types of state:- i)Static state .(ii)Dynamic state. i) Static state:- Like- Id, Name , Gender , etc. ii) Dynamic state:- Like- Age, Mobile number.
  • 45. Human resources slide 4 Placement Training Introduction to C++ Characteristics of an Object:- 2) Behavior:- How an object act or react. Ex:-A Faculty object : behavior is taking lectures. 3) Identity:- It distinguish one object to another. It provide uniqueness. Ex:- Emp_Id = 101 , Stud_Id = s01, etc. 4) Responsibility:- The role it serves. Ex:- A Faculty object : To do allotted work(4Lectures).
  • 46. Human resources slide 4 Placement Training Introduction to C++ Class:- Why class? • The main purpose of C++ programming is to add object orientation to the C programming language . • Classes are the central feature of C++ that supports object-oriented programming and are often called user-defined types. What is class? 1). Class can be compared to a template or Mold out of which similar kind of objects are created.
  • 47. Human resources slide 4 Placement Training Introduction to C++ Class:- 2)A class is like a blueprint for an object. 3)It combines data representation and methods/Functions for manipulating that data into one neat package. 4)The data(variables) and functions (methods) within a class are called members of the class.
  • 48. Human resources slide 4 Placement Training Introduction to C++ Class:- 2)A class is a user defined data type that has data and functions as a member. Example: Student class and studId , studName are the data members . Studmarks(), studResult(), are the member functions(properties) .[s1,s2,s3 are the same kind of objects]
  • 49. Human resources slide 4 Placement Training Introduction to C++ Class:-
  • 50. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- 1)Abstraction. 2) Encapsulation. 3) Inheritance. 4) Polymorphism. 1) Abstraction:- Data abstraction is one of the most essential and important feature of object- oriented programming. • Data abstraction refers to providing only essential information about the data to the outside world, hiding the background details or implementation.
  • 51. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- Abstraction : (Ex:- Car, Coffee machine, ATM , etc.) Real life ex:- Consider a real-life example of a man driving a car. The man only knows that pressing the accelerators will increase the speed of car or applying brakes will stop the car . But he does not know about how on pressing accelerator the speed is increasing, He does not know about the inner mechanism of the car or the implementation of accelerator, brakes etc. in the car. This is what abstraction is.
  • 52. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- • Abstraction in programming: We can implement Abstraction in programming using classes. • Class helps us to group data members and member functions using available access specifiers . • A Class can decide which data member will be visible to outside world and which is not.
  • 53. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- • Advantages of Data Abstraction: • Helps the user to avoid writing the low-level code • Avoids code duplication and increases reusability. • Can change internal implementation of class independently without affecting the user. • Helps to increase security of an application or program as only important details are provided to the user.
  • 54. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- 2) Encapsulation:- In OOP, Encapsulation is defined as the data and the functions binding together in a single unit (class) that manipulates them. Real life Ex: In a company there are different sections like the accounts section, finance section, sales section etc. The finance section handles all the financial transactions and keep records of all the data related to finance , similarly other department handles.
  • 55. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- 2) Encapsulation Real life Ex:- • Now there may arise a situation when for some reason an official from finance section needs all the data about sales in a particular month. • In this case, he is not allowed to directly access the data of sales section. He will first have to contact some other officer in the sales section and then request him to give the data. • This is what encapsulation is. Here the data of sales section and the employees that can manipulate them are wrapped under a single name “sales section”.
  • 56. Human resources slide 4 Placement Training Introduction to C++
  • 57. Human resources slide 4 Placement Training Introduction to C++ Encapsulation Program:- Thus, we can say that here, the variable x and the functions get() and set() are bind together which is nothing but encapsulation. • As using encapsulation also hides the data. In the above example the data of any of the section like sales, finance or accounts is hidden from any other section. • In C++ encapsulation can be implemented using Class and access modifiers.
  • 58. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- 3) Inheritance:- Inheritance is one of the most important feature of Object-Oriented Programming.  The capability of a class to derive properties and characteristics from another class is called Inheritance.  Sub Class: The class that inherits properties from another class is called Sub class or Derived Class.  Super Class: The class whose properties are inherited by sub class is called Base Class or Super class.
  • 59. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- • 3) Inheritance Examples[Vehicles, shapes, fruits,Employee] • Consider a group of vehicles. • You need to create classes for Bus, Car and Truck. • The methods fuelAmount(), capacity(), applyBrakes() will be same for all the three classes. • If we create these classes avoiding inheritance, then we must write all these functions in each of the three classes as shown in below figure:
  • 60. Human resources slide 4 Placement Training Introduction to C++ Example of Inheritance
  • 61. Human resources slide 4 Placement Training Introduction to C++ Example of Inheritance
  • 62. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- 4)Polymorphism:-It is one of the most imp feature of OOP. The word Polymorphism means Many forms. Polymorphism = Poly + Morph (Many) (Forms) Definition: We can define polymorphism, as the ability of a message to be displayed in more than one form. Example:- Consider an electricity, passed to different objects like Light , Fan , Laptop, Desktop , etc.
  • 63. Human resources slide 4 Placement Training Introduction to C++ Polymorphism Example: A Boy
  • 64. Human resources slide 4 Placement Training Introduction to C++ Polymorphism Example: Shape class
  • 65. Human resources slide 4 Placement Training Introduction to C++ Types of Polymorphism
  • 66. Human resources slide 4 Placement Training Introduction to C++ OOP Concepts:- 4)Polymorphism:- Advantages of Polymorphism: 1) Generic code 2) Extensibility 3) Code sharing 4) Reduction in complexity Disadvantages of Polymorphism: 1) Just by looking at the source code, it is not possible to determine which code is executed.
  • 67. Human resources slide 10 Thank You Varsha Yaduvanshi