SlideShare a Scribd company logo
Object Oriented
Programming using C++
UGCA 1909
What is C++?
► C++ is a cross-platform language that can be used to create high-performance
applications.
► C++ was developed by Bjarne Stroustrup, as an extension to the C language.
► C++ gives programmers a high level of control over system resources and
memory.
Why Use C++?
► C++ is one of the world's most popular programming languages.
► C++ can be found in today's operating systems, Graphical User Interfaces, and
embedded systems.
► C++ is an object-oriented programming language which gives a clear structure to
programs and allows code to be reused, lowering development costs.
► C++ is portable and can be used to develop applications that can be adapted to
multiple platforms.
► C++ is fun and easy to learn!
Introduction to C++ Programming
Language
► C++ is a general-purpose programming language that was developed as an
enhancement of the C language to include object-oriented paradigm.
► It is a compiled language.
C vs. C++
What is C?
► C is a structural or procedural oriented programming language which is
machine-independent and extensively used in various applications.
► C is the basic programming language that can be used to develop from the
operating systems (like Windows) to complex programs like Oracle database,
Python interpreter, and many more.
► If we know the C language, then we can easily learn other programming
languages.
► C language was developed by the great computer scientist Dennis Ritchie at
the Bell Laboratories.
► It contains some additional features that make it unique from other
programming languages.
What is C++?
► C++ is a special-purpose programming language developed by Bjarne
Stroustrup at Bell Labs circa 1980.
► C++ language is very similar to C language, and it is so compatible with C that
it can run 99% of C programs without changing any source of code though C++
is an object-oriented programming language, so it is safer and well-structured
programming language than C.
C vs. C++
No. C C++
1) C follows the procedural style programming. C++ is multi-paradigm. It supports both procedural and object
oriented.
2) Data is less secured in C. In C++, you can use modifiers for class members to make it
inaccessible for outside users.
3) C follows the top-down approach. C++ follows the bottom-up approach.
4) C does not support function overloading. C++ supports function overloading.
5) In C, you can't use functions in structure. In C++, you can use functions in classes.
6) C does not support reference variables. C++ supports reference variables.
7) In C, scanf() and printf() are mainly used for input/output. C++ mainly uses stream cin and cout to perform input and
output operations.
8) Operator overloading is not possible in C. Operator overloading is possible in C++.
9) C programs are divided into procedures and modules C++ programs are divided into functions and classes.
10) C does not provide the feature of namespace. C++ supports the feature of namespace.
11) Exception handling is not easy in C. It has to perform using other
functions.
C++ provides exception handling using Try and Catch block.
12) C does not support the inheritance. C++ supports inheritance.
C++ history
► C++ programming language was developed in 1980 by Bjarne Stroustrup at bell
laboratories of AT&T (American Telephone & Telegraph), located in U.S.A.
► It was developed for adding a feature of OOP (Object Oriented Programming)
in C without significantly changing the C component.
► C++ programming is "relative" (called a superset) of C, it means any valid C
program is also a valid C++ program.
The History of C++
BCPL 1967
1970
1972
B
C
C++
ANSI C
1989
1983
Martin Richards.
No types
Ken Thompson
Dennis Ritchie
Some Types
The standard.
Strong Typing
Bjarne Stroustrup
OOP
C++ Features
► C++ is object oriented programming language. It provides a lot of features that are
given below.
1. Simple
2. Machine Independent or Portable
3. Mid-level programming language
4. Structured programming language
5. Rich Library
6. Memory Management
7. Fast Speed
8. Pointers
9. Recursion
10. Extensible
11. Object Oriented
12. Compiler based
C++ Features
Explanation
1) Simple
► C++ is a simple language in the sense that it provides structured approach (to
break the problem into parts), rich set of library functions, data types etc.
2) Machine Independent or Portable
► Unlike assembly language, c programs can be executed in many machines
with little bit or no change. But it is not platform-independent.
► A C++ program is not platform-independent (compiled programs on Linux
won't run on Windows), however they are machine independent.
3) Mid-level programming language
► C++ is also used to do low level programming. It is used to develop system
applications such as kernel, driver etc. It also supports the feature of high
level language. That is why it is known as mid-level language.
4) Structured programming language
► C++ is a structured programming language in the sense that we can break the
program into parts using functions. So, it is easy to understand and modify.
5) Rich Library
► C++ provides a lot of inbuilt functions that makes the development fast.
6) Memory Management
► It supports the feature of dynamic memory allocation. In C++ language, we can free
the allocated memory at any time by calling the free() function.
7) Speed
► The compilation and execution time of C++ language is fast.
8) Pointer
► C++ provides the feature of pointers. We can directly interact with the memory by
using the pointers. We can use pointers for memory, structures, functions, array
etc.
9) Recursion
► In C++, we can call the function within the function. It provides code reusability for
every function.
10) Extensible
► C++ language is extensible because it can easily adopt new features.
11) Object Oriented
► C++ is object oriented programming language. OOPs makes development and
maintenance easier where as in Procedure-oriented programming language it is not
easy to manage if code grows as project size grows.
12) Compiler based
► C++ is a compiler based programming language, it means without compilation no
C++ program can be executed. First we need to compile our program using compiler
and then we can execute our program.
OOPs (Object Oriented Programming
System)
► Object means a real word entity such as pen, chair, table etc.
► Object-Oriented Programming is a methodology or paradigm to design a program
using classes and objects.
► It simplifies the software development and maintenance by providing some
concepts:
► Object
► Class
► Inheritance
► Polymorphism
► Abstraction
► Encapsulation
OOPs Concepts
► Object
Any entity that has state and behavior is known as an object. For example: chair, pen,
table, keyboard, bike etc. It can be physical and logical.
► Class
Collection of objects is called class. It is a logical entity.
► Inheritance
When one object acquires all the properties and behaviours of parent object i.e. known as
inheritance. It provides code reusability. It is used to achieve runtime polymorphism.
► Polymorphism
When one task is performed by different ways i.e. known as polymorphism. For example: to
convince the customer differently, to draw something e.g. shape or rectangle etc.
In C++, we use Function overloading and Function overriding to achieve polymorphism.
► Abstraction
Hiding internal details and showing functionality is known as abstraction. For
example: phone call, we don't know the internal processing.
In C++, we use abstract class and interface to achieve abstraction.
► Encapsulation
Binding (or wrapping) code and data together into a single unit is known as
encapsulation. For example: capsule, it is wrapped with different medicines.
Advantage of OOPs over
Procedure-oriented programming
language
► OOPs makes development and maintenance easier where as in
Procedure-oriented programming language it is not easy to manage if code
grows as project size grows.
► OOPs provide data hiding whereas in Procedure-oriented programming
language a global data can be accessed from anywhere.
► OOPs provide ability to simulate real-world event much more effectively. We
can provide the solution of real word problem if we are using the Object-
Oriented Programming language.
Turbo C++ - Download & Installation
► There are many compilers available for C++. You need to download any one.
Here, we are going to use Turbo C++. It will work for both C and C++. To
install the Turbo C++ software, you need to follow following steps.
► Download Turbo C++
► Create turboc directory inside c drive and extract the tc3.zip inside c:turboc
► Double click on install.exe file
► Click on the tc application file located inside c:TCBIN to write the c program
C++ Program
#include <iostream.h>
#include<conio.h>
void main() {
clrscr();
cout << "Welcome to C++ Programming.";
getch();
}
Explanation
► #include<iostream.h> includes the standard input output library functions. It
provides cin and cout methods for reading from input and writing to output
respectively.
► #include <conio.h> includes the console input output library functions. The getch()
function is defined in conio.h file.
► void main() The main() function is the entry point of every program in C++ language.
The void keyword specifies that it returns no value.
► cout << "Welcome to C++ Programming." is used to print the data "Welcome to C++
Programming." on the console.
► getch() The getch() function asks for a single character. Until you press any key, it
blocks the screen.
How to compile and run the C++ program
► There are 2 ways to compile and run the C++ program, by menu and by shortcut.
► By menu
Now click on the compile menu then compile sub menu to compile the c++ program.
► Then click on the run menu then run sub menu to run the c++ program.
► By shortcut
Or, press ctrl+f9 keys compile and run the program directly.
Output screen
You can view the user screen any time by pressing the alt+f5 keys.
C++ Basic Input/Output
► C++ I/O operation is using the stream concept. Stream is the sequence of
bytes or flow of data. It makes the performance fast.
► If bytes flow from main memory to device like printer, display screen, or a
network connection, etc, this is called as output operation.
► If bytes flow from device like printer, display screen, or a network
connection, etc to main memory, this is called as input operation.
► <iostream> It is used to define the cout, cin and cerr objects, which
correspond to standard output stream, standard input stream and standard
error stream, respectively.
Standard output stream (cout)
► The cout is a predefined object of ostream class.
► It is connected with the standard output device, which is usually a display
screen.
► The cout is used in conjunction with stream insertion operator (<<) to display
the output on a console.
#include <iostream>
using namespace std;
int main( ) {
char a[] = "Welcome to C++ ";
cout << "Value of ary is: " << a << endl;
}
Output:
Value of a is: Welcome to C++
Standard input stream (cin)
► The cin is a predefined object of istream class.
► It is connected with the standard input device, which is usually a keyboard.
► The cin is used in conjunction with stream extraction operator (>>) to read
the input from a console.
#include <iostream>
using namespace std;
int main( ) {
int age;
cout << "Enter your age: ";
cin >> age;
cout << "Your age is: " << age << endl;
}
Output:
Enter your age: 22
Your age is: 22
Standard end line (endl)
► The endl is a predefined object of ostream class. It is used to insert a new
line characters and flushes the stream.
#include <iostream>
using namespace std;
int main( ) {
cout << "C++ ";
cout << " Program"<<endl;
cout << "End of line"<<endl;
}
Output:
C++ Program
End of line
object oriented programming language fundamentals

More Related Content

Similar to object oriented programming language fundamentals (20)

C++ with student management system project
C++ with student management system projectC++ with student management system project
C++ with student management system project
Kratik Khandelwal
 
C++ l 1
C++ l 1C++ l 1
C++ l 1
vineet_singh
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
Waqar Younis
 
A Complete Guide to Programming in C 1st Edition Ulla Kirch-Prinz
A Complete Guide to Programming in C 1st Edition Ulla Kirch-PrinzA Complete Guide to Programming in C 1st Edition Ulla Kirch-Prinz
A Complete Guide to Programming in C 1st Edition Ulla Kirch-Prinz
loadedalizwa
 
Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1Object Oriented Programming using C++ - Part 1
Object Oriented Programming using C++ - Part 1
University College of Engineering Kakinada, JNTUK - Kakinada, India
 
1. Introduction to C++ and brief history
1. Introduction to C++ and brief history1. Introduction to C++ and brief history
1. Introduction to C++ and brief history
Ahmad177077
 
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C++  Langauage Training in Ambala ! BATRA COMPUTER CENTREC++  Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
jatin batra
 
Unit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptxUnit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptx
shashiden1
 
C++
C++C++
C++
SamreenShaikh26
 
Introduction to c++ programming language
Introduction to c++ programming languageIntroduction to c++ programming language
Introduction to c++ programming language
Ahmad177077
 
C++ Programming with examples for B.Tech
C++ Programming with examples for B.TechC++ Programming with examples for B.Tech
C++ Programming with examples for B.Tech
ashutoshgupta1102
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
Manoj Kumar
 
C-and-Cpp-Brochure-English. .
C-and-Cpp-Brochure-English.               .C-and-Cpp-Brochure-English.               .
C-and-Cpp-Brochure-English. .
spotguys705
 
The C++ Programming Language
The C++ Programming LanguageThe C++ Programming Language
The C++ Programming Language
Prof Ansari
 
Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++
Vaibhav Khanna
 
Advantage and Disadvantages of C++ programming.pptx
Advantage and Disadvantages of C++ programming.pptxAdvantage and Disadvantages of C++ programming.pptx
Advantage and Disadvantages of C++ programming.pptx
phalapagol
 
M.c.a (sem iii) paper - i - object oriented programming
M.c.a (sem   iii) paper - i - object oriented programmingM.c.a (sem   iii) paper - i - object oriented programming
M.c.a (sem iii) paper - i - object oriented programming
रवींद्र वैद्य
 
Procedure Oriented programming Object Oriented programming Basic Concept of ...
Procedure Oriented programming Object Oriented programming  Basic Concept of ...Procedure Oriented programming Object Oriented programming  Basic Concept of ...
Procedure Oriented programming Object Oriented programming Basic Concept of ...
Govt Engineering college badliya ajmer Rajasthan
 
Session 1 - c++ intro
Session   1 - c++ introSession   1 - c++ intro
Session 1 - c++ intro
VijayaNagarajan5
 
c++
 c++  c++
c++
SindhuVelmukull
 
C++ with student management system project
C++ with student management system projectC++ with student management system project
C++ with student management system project
Kratik Khandelwal
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
Waqar Younis
 
A Complete Guide to Programming in C 1st Edition Ulla Kirch-Prinz
A Complete Guide to Programming in C 1st Edition Ulla Kirch-PrinzA Complete Guide to Programming in C 1st Edition Ulla Kirch-Prinz
A Complete Guide to Programming in C 1st Edition Ulla Kirch-Prinz
loadedalizwa
 
1. Introduction to C++ and brief history
1. Introduction to C++ and brief history1. Introduction to C++ and brief history
1. Introduction to C++ and brief history
Ahmad177077
 
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C++  Langauage Training in Ambala ! BATRA COMPUTER CENTREC++  Langauage Training in Ambala ! BATRA COMPUTER CENTRE
C++ Langauage Training in Ambala ! BATRA COMPUTER CENTRE
jatin batra
 
Unit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptxUnit 1 introduction to c++.pptx
Unit 1 introduction to c++.pptx
shashiden1
 
Introduction to c++ programming language
Introduction to c++ programming languageIntroduction to c++ programming language
Introduction to c++ programming language
Ahmad177077
 
C++ Programming with examples for B.Tech
C++ Programming with examples for B.TechC++ Programming with examples for B.Tech
C++ Programming with examples for B.Tech
ashutoshgupta1102
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
Manoj Kumar
 
C-and-Cpp-Brochure-English. .
C-and-Cpp-Brochure-English.               .C-and-Cpp-Brochure-English.               .
C-and-Cpp-Brochure-English. .
spotguys705
 
The C++ Programming Language
The C++ Programming LanguageThe C++ Programming Language
The C++ Programming Language
Prof Ansari
 
Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++
Vaibhav Khanna
 
Advantage and Disadvantages of C++ programming.pptx
Advantage and Disadvantages of C++ programming.pptxAdvantage and Disadvantages of C++ programming.pptx
Advantage and Disadvantages of C++ programming.pptx
phalapagol
 

Recently uploaded (20)

Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Celine George
 
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
EUPHORIA GENERAL QUIZ FINALS | QUIZ CLUB OF PSGCAS | 21 MARCH 2025
Quiz Club of PSG College of Arts & Science
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 EmployeeHow to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
Allomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdfAllomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdf
Abha Pandey
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
Respiratory System , Urinary System
Respiratory  System , Urinary SystemRespiratory  System , Urinary System
Respiratory System , Urinary System
RushiMandali
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
LDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad UpdatesLDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad Updates
LDM & Mia eStudios
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
What are the benefits that dance brings?
What are the benefits that dance brings?What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17Different pricelists for different shops in odoo Point of Sale in Odoo 17
Different pricelists for different shops in odoo Point of Sale in Odoo 17
Celine George
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti MpdBasic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
How to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 EmployeeHow to Manage & Create a New Department in Odoo 18 Employee
How to Manage & Create a New Department in Odoo 18 Employee
Celine George
 
Adam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational PsychologyAdam Grant: Transforming Work Culture Through Organizational Psychology
Adam Grant: Transforming Work Culture Through Organizational Psychology
Prachi Shah
 
Allomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdfAllomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdf
Abha Pandey
 
Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.Artificial intelligence Presented by JM.
Artificial intelligence Presented by JM.
jmansha170
 
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
Module 4 Presentation - Enhancing Competencies and Engagement Strategies in Y...
GeorgeDiamandis11
 
Parenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independenceParenting Teens: Supporting Trust, resilience and independence
Parenting Teens: Supporting Trust, resilience and independence
Pooky Knightsmith
 
Respiratory System , Urinary System
Respiratory  System , Urinary SystemRespiratory  System , Urinary System
Respiratory System , Urinary System
RushiMandali
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition OecdEnergy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
LDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad UpdatesLDMMIA Reiki Yoga Next Week Grad Updates
LDMMIA Reiki Yoga Next Week Grad Updates
LDM & Mia eStudios
 
What is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptxWhat is FIle and explanation of text files.pptx
What is FIle and explanation of text files.pptx
Ramakrishna Reddy Bijjam
 
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition IILDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDMMIA Free Reiki Yoga S9 Grad Level Intuition II
LDM & Mia eStudios
 
Final Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptxFinal Sketch Designs for poster production.pptx
Final Sketch Designs for poster production.pptx
bobby205207
 
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKANMATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
MATERI PPT TOPIK 4 LANDASAN FILOSOFIS PENDIDIKAN
aditya23173
 
Ray Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big CycleRay Dalio How Countries go Broke the Big Cycle
Ray Dalio How Countries go Broke the Big Cycle
Dadang Solihin
 
What are the benefits that dance brings?
What are the benefits that dance brings?What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
Hemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptxHemiptera & Neuroptera: Insect Diversity.pptx
Hemiptera & Neuroptera: Insect Diversity.pptx
Arshad Shaikh
 
Ad

object oriented programming language fundamentals

  • 2. What is C++? ► C++ is a cross-platform language that can be used to create high-performance applications. ► C++ was developed by Bjarne Stroustrup, as an extension to the C language. ► C++ gives programmers a high level of control over system resources and memory.
  • 3. Why Use C++? ► C++ is one of the world's most popular programming languages. ► C++ can be found in today's operating systems, Graphical User Interfaces, and embedded systems. ► C++ is an object-oriented programming language which gives a clear structure to programs and allows code to be reused, lowering development costs. ► C++ is portable and can be used to develop applications that can be adapted to multiple platforms. ► C++ is fun and easy to learn!
  • 4. Introduction to C++ Programming Language ► C++ is a general-purpose programming language that was developed as an enhancement of the C language to include object-oriented paradigm. ► It is a compiled language.
  • 5. C vs. C++ What is C? ► C is a structural or procedural oriented programming language which is machine-independent and extensively used in various applications. ► C is the basic programming language that can be used to develop from the operating systems (like Windows) to complex programs like Oracle database, Python interpreter, and many more. ► If we know the C language, then we can easily learn other programming languages. ► C language was developed by the great computer scientist Dennis Ritchie at the Bell Laboratories. ► It contains some additional features that make it unique from other programming languages.
  • 6. What is C++? ► C++ is a special-purpose programming language developed by Bjarne Stroustrup at Bell Labs circa 1980. ► C++ language is very similar to C language, and it is so compatible with C that it can run 99% of C programs without changing any source of code though C++ is an object-oriented programming language, so it is safer and well-structured programming language than C.
  • 7. C vs. C++ No. C C++ 1) C follows the procedural style programming. C++ is multi-paradigm. It supports both procedural and object oriented. 2) Data is less secured in C. In C++, you can use modifiers for class members to make it inaccessible for outside users. 3) C follows the top-down approach. C++ follows the bottom-up approach. 4) C does not support function overloading. C++ supports function overloading. 5) In C, you can't use functions in structure. In C++, you can use functions in classes. 6) C does not support reference variables. C++ supports reference variables. 7) In C, scanf() and printf() are mainly used for input/output. C++ mainly uses stream cin and cout to perform input and output operations. 8) Operator overloading is not possible in C. Operator overloading is possible in C++. 9) C programs are divided into procedures and modules C++ programs are divided into functions and classes. 10) C does not provide the feature of namespace. C++ supports the feature of namespace. 11) Exception handling is not easy in C. It has to perform using other functions. C++ provides exception handling using Try and Catch block. 12) C does not support the inheritance. C++ supports inheritance.
  • 8. C++ history ► C++ programming language was developed in 1980 by Bjarne Stroustrup at bell laboratories of AT&T (American Telephone & Telegraph), located in U.S.A. ► It was developed for adding a feature of OOP (Object Oriented Programming) in C without significantly changing the C component. ► C++ programming is "relative" (called a superset) of C, it means any valid C program is also a valid C++ program.
  • 9. The History of C++ BCPL 1967 1970 1972 B C C++ ANSI C 1989 1983 Martin Richards. No types Ken Thompson Dennis Ritchie Some Types The standard. Strong Typing Bjarne Stroustrup OOP
  • 10. C++ Features ► C++ is object oriented programming language. It provides a lot of features that are given below. 1. Simple 2. Machine Independent or Portable 3. Mid-level programming language 4. Structured programming language 5. Rich Library 6. Memory Management 7. Fast Speed 8. Pointers 9. Recursion 10. Extensible 11. Object Oriented 12. Compiler based
  • 12. Explanation 1) Simple ► C++ is a simple language in the sense that it provides structured approach (to break the problem into parts), rich set of library functions, data types etc. 2) Machine Independent or Portable ► Unlike assembly language, c programs can be executed in many machines with little bit or no change. But it is not platform-independent. ► A C++ program is not platform-independent (compiled programs on Linux won't run on Windows), however they are machine independent.
  • 13. 3) Mid-level programming language ► C++ is also used to do low level programming. It is used to develop system applications such as kernel, driver etc. It also supports the feature of high level language. That is why it is known as mid-level language. 4) Structured programming language ► C++ is a structured programming language in the sense that we can break the program into parts using functions. So, it is easy to understand and modify. 5) Rich Library ► C++ provides a lot of inbuilt functions that makes the development fast.
  • 14. 6) Memory Management ► It supports the feature of dynamic memory allocation. In C++ language, we can free the allocated memory at any time by calling the free() function. 7) Speed ► The compilation and execution time of C++ language is fast. 8) Pointer ► C++ provides the feature of pointers. We can directly interact with the memory by using the pointers. We can use pointers for memory, structures, functions, array etc. 9) Recursion ► In C++, we can call the function within the function. It provides code reusability for every function.
  • 15. 10) Extensible ► C++ language is extensible because it can easily adopt new features. 11) Object Oriented ► C++ is object oriented programming language. OOPs makes development and maintenance easier where as in Procedure-oriented programming language it is not easy to manage if code grows as project size grows. 12) Compiler based ► C++ is a compiler based programming language, it means without compilation no C++ program can be executed. First we need to compile our program using compiler and then we can execute our program.
  • 16. OOPs (Object Oriented Programming System) ► Object means a real word entity such as pen, chair, table etc. ► Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. ► It simplifies the software development and maintenance by providing some concepts: ► Object ► Class ► Inheritance ► Polymorphism ► Abstraction ► Encapsulation
  • 17. OOPs Concepts ► Object Any entity that has state and behavior is known as an object. For example: chair, pen, table, keyboard, bike etc. It can be physical and logical. ► Class Collection of objects is called class. It is a logical entity. ► Inheritance When one object acquires all the properties and behaviours of parent object i.e. known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism. ► Polymorphism When one task is performed by different ways i.e. known as polymorphism. For example: to convince the customer differently, to draw something e.g. shape or rectangle etc. In C++, we use Function overloading and Function overriding to achieve polymorphism.
  • 18. ► Abstraction Hiding internal details and showing functionality is known as abstraction. For example: phone call, we don't know the internal processing. In C++, we use abstract class and interface to achieve abstraction. ► Encapsulation Binding (or wrapping) code and data together into a single unit is known as encapsulation. For example: capsule, it is wrapped with different medicines.
  • 19. Advantage of OOPs over Procedure-oriented programming language ► OOPs makes development and maintenance easier where as in Procedure-oriented programming language it is not easy to manage if code grows as project size grows. ► OOPs provide data hiding whereas in Procedure-oriented programming language a global data can be accessed from anywhere. ► OOPs provide ability to simulate real-world event much more effectively. We can provide the solution of real word problem if we are using the Object- Oriented Programming language.
  • 20. Turbo C++ - Download & Installation ► There are many compilers available for C++. You need to download any one. Here, we are going to use Turbo C++. It will work for both C and C++. To install the Turbo C++ software, you need to follow following steps. ► Download Turbo C++ ► Create turboc directory inside c drive and extract the tc3.zip inside c:turboc ► Double click on install.exe file ► Click on the tc application file located inside c:TCBIN to write the c program
  • 21. C++ Program #include <iostream.h> #include<conio.h> void main() { clrscr(); cout << "Welcome to C++ Programming."; getch(); }
  • 22. Explanation ► #include<iostream.h> includes the standard input output library functions. It provides cin and cout methods for reading from input and writing to output respectively. ► #include <conio.h> includes the console input output library functions. The getch() function is defined in conio.h file. ► void main() The main() function is the entry point of every program in C++ language. The void keyword specifies that it returns no value. ► cout << "Welcome to C++ Programming." is used to print the data "Welcome to C++ Programming." on the console. ► getch() The getch() function asks for a single character. Until you press any key, it blocks the screen.
  • 23. How to compile and run the C++ program ► There are 2 ways to compile and run the C++ program, by menu and by shortcut. ► By menu Now click on the compile menu then compile sub menu to compile the c++ program. ► Then click on the run menu then run sub menu to run the c++ program. ► By shortcut Or, press ctrl+f9 keys compile and run the program directly.
  • 24. Output screen You can view the user screen any time by pressing the alt+f5 keys.
  • 25. C++ Basic Input/Output ► C++ I/O operation is using the stream concept. Stream is the sequence of bytes or flow of data. It makes the performance fast. ► If bytes flow from main memory to device like printer, display screen, or a network connection, etc, this is called as output operation. ► If bytes flow from device like printer, display screen, or a network connection, etc to main memory, this is called as input operation. ► <iostream> It is used to define the cout, cin and cerr objects, which correspond to standard output stream, standard input stream and standard error stream, respectively.
  • 26. Standard output stream (cout) ► The cout is a predefined object of ostream class. ► It is connected with the standard output device, which is usually a display screen. ► The cout is used in conjunction with stream insertion operator (<<) to display the output on a console. #include <iostream> using namespace std; int main( ) { char a[] = "Welcome to C++ "; cout << "Value of ary is: " << a << endl; } Output: Value of a is: Welcome to C++
  • 27. Standard input stream (cin) ► The cin is a predefined object of istream class. ► It is connected with the standard input device, which is usually a keyboard. ► The cin is used in conjunction with stream extraction operator (>>) to read the input from a console. #include <iostream> using namespace std; int main( ) { int age; cout << "Enter your age: "; cin >> age; cout << "Your age is: " << age << endl; } Output: Enter your age: 22 Your age is: 22
  • 28. Standard end line (endl) ► The endl is a predefined object of ostream class. It is used to insert a new line characters and flushes the stream. #include <iostream> using namespace std; int main( ) { cout << "C++ "; cout << " Program"<<endl; cout << "End of line"<<endl; } Output: C++ Program End of line