SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
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 196
7
B 197
0
C 197
2
C++
ANSI C
198
9
198
3
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 c++

Weitere ähnliche Inhalte

Was ist angesagt?

Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingAmit Soni (CTFL)
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C LanguageShaina Arora
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programAAKASH KUMAR
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++rprajat007
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)MD Sulaiman
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingMoutaz Haddara
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT03062679929
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingMd. Tanvir Hossain
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS ConceptBoopathi K
 
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.pptTareq Hasan
 
Compiler Design
Compiler DesignCompiler Design
Compiler DesignMir Majid
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in CHarendra Singh
 

Was ist angesagt? (20)

Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
 
C by balaguruswami - e.balagurusamy
C   by balaguruswami - e.balagurusamyC   by balaguruswami - e.balagurusamy
C by balaguruswami - e.balagurusamy
 
c++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ programc++ programming Unit 2 basic structure of a c++ program
c++ programming Unit 2 basic structure of a c++ program
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
C introduction by thooyavan
C introduction by  thooyavanC introduction by  thooyavan
C introduction by thooyavan
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)Fundamentals of OOP (Object Oriented Programming)
Fundamentals of OOP (Object Oriented Programming)
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Oops
OopsOops
Oops
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
Introduction to Object Oriented Programming
Introduction to Object Oriented ProgrammingIntroduction to Object Oriented Programming
Introduction to Object Oriented Programming
 
Python programming : Classes objects
Python programming : Classes objectsPython programming : Classes objects
Python programming : Classes objects
 
C++ OOPS Concept
C++ OOPS ConceptC++ OOPS Concept
C++ OOPS Concept
 
08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt08 c++ Operator Overloading.ppt
08 c++ Operator Overloading.ppt
 
Basics of c++
Basics of c++Basics of c++
Basics of c++
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
 
Function in C program
Function in C programFunction in C program
Function in C program
 

Ähnlich wie Object oriented programming c++

object oriented programming language fundamentals
object oriented programming language fundamentalsobject oriented programming language fundamentals
object oriented programming language fundamentalsChaithraCSHirematt
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionAKR Education
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxshokeenk14
 
c programming, internshala training , govt engineering college aurangabad
c programming, internshala training , govt engineering college aurangabadc programming, internshala training , govt engineering college aurangabad
c programming, internshala training , govt engineering college aurangabadPysh1
 
C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#sudipv
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...bhargavi804095
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...bhargavi804095
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfAnassElHousni
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docMayurWagh46
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxNEHARAJPUT239591
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJmeharikiros2
 
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREjatin batra
 
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTERC++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTERgroversimrans
 
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
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++Manoj Kumar
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxCoolGamer16
 

Ähnlich wie Object oriented programming c++ (20)

object oriented programming language fundamentals
object oriented programming language fundamentalsobject oriented programming language fundamentals
object oriented programming language fundamentals
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
Summer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptxSummer training PPT Manasv Singharia.pptx
Summer training PPT Manasv Singharia.pptx
 
c programming, internshala training , govt engineering college aurangabad
c programming, internshala training , govt engineering college aurangabadc programming, internshala training , govt engineering college aurangabad
c programming, internshala training , govt engineering college aurangabad
 
C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#
 
C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...C++ helps you to format the I/O operations like determining the number of dig...
C++ helps you to format the I/O operations like determining the number of dig...
 
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
C++ was developed by Bjarne Stroustrup, as an extension to the C language. cp...
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
C++Basics2022.pptx
C++Basics2022.pptxC++Basics2022.pptx
C++Basics2022.pptx
 
Session 1 - c++ intro
Session   1 - c++ introSession   1 - c++ intro
Session 1 - c++ intro
 
Introduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).docIntroduction-to-C-Part-1 (1).doc
Introduction-to-C-Part-1 (1).doc
 
Part 1
Part 1Part 1
Part 1
 
Introduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptxIntroduction-to-C-Part-1.pptx
Introduction-to-C-Part-1.pptx
 
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJIntroduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
Introduction-to-C-Part-1 JSAHSHAHSJAHSJAHSJHASJ
 
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
 
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTERC++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
 
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++
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptx
 
Oops index
Oops indexOops index
Oops index
 

Kürzlich hochgeladen

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Kürzlich hochgeladen (20)

Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 

Object oriented programming c++

  • 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 196 7 B 197 0 C 197 2 C++ ANSI C 198 9 198 3 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