SlideShare a Scribd company logo
1 of 33
Sayed Ahmed
Just E.T.C Technologies Inc.
Just E.T.C. Education Inc.
 C++ is based on and an extension to C
 Knowing similarities and dissimilarities between C
and C++ will help
 to select the right language for your application
development
 Comments:
 Header File: #include <iostream>
 Namespace: A defined collection of symbols and
variable names within an application
 The main () function: must have in a program
 Parentheses: A function/code block name is followed
by Parentheses ()
 Braces: Boundary of code blocks
 Variables: Used to contain values. Think about
variables in Mathematics
 Statements: An instruction to the computer hardware
to perform specific action.
 Statement Terminator: a semicolon
 Function calls:
 One function can call another function.
 It's just a transfer of control from one code block to
another code block.
 However, the control comes back to the caller again.
 #include <iostream>
 using namespace std;
 int main() {
 int studentId;
 count << "what is your student ID" << endl;
 cin>> studentId;
 count << "Student Id " << studentId << endl;
 }
 A C++ program must have a namespace;
 C program ends with .c
 where C++ program ends with .cpp
 Information communication to and from c program is
treated as stream.
 cout and cin are used for the purpose
 cout and cin are practically objects
 To store values
 case sensitive
 must start with letter
 Supportted datatypes: char, int, float, double, boolean,
wchar_t
 float: usually 32 bits - 6 digit after decimam,
 double: 64 bits - 10 digit after decimal,
 Can be declared anywhere
 Local:
 inside functions
 Static:
 Inside functions but do not get destroyed after
 Global:
 Declared outside the functions
 can be accessed from anywhere in the program
 Formal/Parameter
 Hidden variable:
 if a local variable use the same name of a global variable the local
variable = hidden variable
 use scope operator :: to access the global variable inside that
function
 Group of variable
 A group of variables of the same type
 in c strings are null terminated arrays
 C++ also supports a predefined string class/data type;
 include <string>
 in c, define XYZ 100
 in c++, const int val=1000
 Enables Code Resuse
 Enables Data Security from Unauthorized Access
 Object:
 Attribute + behaviors
 Primary OOP Concepts
 Encapsulation:
 Inheritance:
 - reduce development time
 - reuse
 -increase maintainability of the code
 Polymorphism:
 assign different uses to an entity based onthe context
 Abstraction:
 simple representation of an objet.
 hide not essential attributes and behaviors
 Object Oriented Paradigm:
 Define objects - toughest
 define messages
 define properties
 --define attributes
 --define behaviors
 Object behavior analysis:
 Understand the application
 Derive Objects
 Categorize Objects
 Model process flow
 C++ Compliers Must Support: ANSI Standard
 Internationalization
 Template
 Locales
 Namespaces
 Friend Class
 Friend functions and inline functions provide faster, and
efficient application
 A function can be friend to any number of functions
 Use function declaration to declare friend functions
 Static Data Members and Static Members
 Function - create the common members of classes
(across objects)
 Constructor
 no return types
 called at object creation
 Destructor
 no return type
 Operator Overloading
 Compile time polymorphism
 runtime poly
 - inheritance
 virtual functions
 Operator Overloading:
 -unary
 -binary
 -arithmetic
 -assignment
 Note: C++ does not support overloading based on return
type
 Early Binding/Late Binding
 Access Modifiers absent = protected
 inheritance and destructors
 Diamond Problem: Virtual Base Class
 Overriding
 Pure Virtual Function
 manipulators
 COUT, setw, right, setfill, flush, endl
 fstreambase
 fstream
 ifstream
 ofstream
 Mode of file opening
 ios::in
 ios::out
 Sscanf
 Read formatted file data
 ifstream
 fin.getLine()
 Random File Reading
 seekg
 seekp
 I/O System
 Buffered file system
 Stream classes
 stream
 istream--_IO_istream_withassign
 ostream
 Iostream
 Cin is an instance of _IO_istream_withassign
 Instance of _IO_ostream_withassign
 cout
 cerr
 Stream formatting flags
 Can be used with setf(), unsetf()
 ios::left
 ios::dec
 ios::fixed
 ios::oct
 ios::right
 ios::scientific
 ios::showbase
 ios::showpoint
 ios::showpos
 ios::uppercase
 Unformatted input/output
 character
 character array
 strings
 use text buffer
 Can provide abstraction of the I/O device
 functions for unformatted input and output
 cin.read()
 cin.gcount()
 cout.write()
 Files
 fstreambase
 opening, manipulating, closing
 fstream, ifstream, ofstream
 mode ios::app, ios::ate, ios::binary, ios::in, ios::out, ios::trunc
 fin.getline()
 Get pointers
 Random Operation Put pointers
 pointers
 Seekg()
 Seekp()
 Tellg()
 Tellp()
 Handling Exceptions
 runtime errors
 Exceptions
 try and catch block
 throw statement
 Uncaught Exceptions
 Multiple Catch
 ----------
 identified by operating systems
 if not handled passed to op system exception as int, char ,class strings
 how it passes through functions
 Derived Class Exceptions
 catch block hierarchy
 place derived classes catch up
 runtime with virtual functions
 shape
 -draw
 rect
 tri
 define overriding by placing function in each
 Show why virtual function needed?
 virtual base
 pointer runtime polymorphism
 pure virtual function
 Late binding
 base point to base - call derive function - runtime-dynamic
 Templates create reusable code
 STL provides some foundational items
 --templatized functions and
 --classes
 These can be used to solve a variety of problems
 Some STL Elements
 Containers
 Algorithms
 Iterators
 STLs are compatible across operating systems
 Containers
 Vectors
 Lists
 Maps
 Containers
 Sequence
 Associative
 Algorithms
 function templates work with container templates of any type
 algorithm header file
 Iterators are objects to cycle through the containers
 iterator header file needs to be included if iterators are used
 Iterator type:
 Random Access
 Bidirectional
 Forward
 Input
 Output
 Vector and Array Comparison
 container - behave the same way - infinite
 Lists: class
 Bidirectional linear sequentially
 Functions
 begin()
 end()
 erase()
 insert(); (template)
 push_back();
 push_front();
 remove();
 splice();
 Associative Container
 Map templates take two parameters
 Functions:
 begin();
 clear();
 count();
 empty();
 end();
 erase();
 insert();
 size()
 Working with Templates
 Imagine a situation - complex + many data type
 Overload may help but time consuming
 template can help
 object creation define data type
 template overloading

More Related Content

What's hot

Understanding C# in .NET
Understanding C# in .NETUnderstanding C# in .NET
Understanding C# in .NETmentorrbuddy
 
Tokens expressionsin C++
Tokens expressionsin C++Tokens expressionsin C++
Tokens expressionsin C++HalaiHansaika
 
Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scannerArif Ullah
 
ppt on scanner class
ppt on scanner classppt on scanner class
ppt on scanner classdeepsxn
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++Nilesh Dalvi
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1stConnex
 
Templates exception handling
Templates exception handlingTemplates exception handling
Templates exception handlingsanya6900
 
Lambda Expressions in Java
Lambda Expressions in JavaLambda Expressions in Java
Lambda Expressions in JavaErhan Bagdemir
 
Java8: what's new and what's hot
Java8: what's new and what's hotJava8: what's new and what's hot
Java8: what's new and what's hotSergii Maliarov
 
Java scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java ScannerJava scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java ScannerEdward Nyang'ali
 
Python Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator OverloadingPython Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator OverloadingRanel Padon
 

What's hot (20)

C++ version 1
C++  version 1C++  version 1
C++ version 1
 
Understanding C# in .NET
Understanding C# in .NETUnderstanding C# in .NET
Understanding C# in .NET
 
Tokens expressionsin C++
Tokens expressionsin C++Tokens expressionsin C++
Tokens expressionsin C++
 
Taking User Input in Java
Taking User Input in JavaTaking User Input in Java
Taking User Input in Java
 
Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scanner
 
Java 8 lambda
Java 8 lambdaJava 8 lambda
Java 8 lambda
 
ppt on scanner class
ppt on scanner classppt on scanner class
ppt on scanner class
 
Input and output in C++
Input and output in C++Input and output in C++
Input and output in C++
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
Templates exception handling
Templates exception handlingTemplates exception handling
Templates exception handling
 
Java input
Java inputJava input
Java input
 
Lambda Expressions in Java
Lambda Expressions in JavaLambda Expressions in Java
Lambda Expressions in Java
 
Scala
ScalaScala
Scala
 
Java8: what's new and what's hot
Java8: what's new and what's hotJava8: what's new and what's hot
Java8: what's new and what's hot
 
Java scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java ScannerJava scanner, everything you need to know about Java Scanner
Java scanner, everything you need to know about Java Scanner
 
Java vs kotlin
Java vs kotlinJava vs kotlin
Java vs kotlin
 
Python Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator OverloadingPython Programming - VII. Customizing Classes and Operator Overloading
Python Programming - VII. Customizing Classes and Operator Overloading
 
Function overloading ppt
Function overloading pptFunction overloading ppt
Function overloading ppt
 
Files io
Files ioFiles io
Files io
 
Java8
Java8Java8
Java8
 

Similar to C++ vs C Differences Guide

Patterns in Python
Patterns in PythonPatterns in Python
Patterns in Pythondn
 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.docabdulhaq467432
 
1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answers1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answersAkash Gawali
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)Netcetera
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1ReKruiTIn.com
 
C questions
C questionsC questions
C questionsparm112
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)rashmita_mishra
 
C++ Interview Question And Answer
C++ Interview Question And AnswerC++ Interview Question And Answer
C++ Interview Question And AnswerJagan Mohan Bishoyi
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answerlavparmar007
 

Similar to C++ vs C Differences Guide (20)

Patterns in Python
Patterns in PythonPatterns in Python
Patterns in Python
 
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
7.-Download_CS201-Solved-Subjective-with-Reference-by-Aqib.doc
 
C#ppt
C#pptC#ppt
C#ppt
 
OOC MODULE1.pptx
OOC MODULE1.pptxOOC MODULE1.pptx
OOC MODULE1.pptx
 
1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answers1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answers
 
SRAVANByCPP
SRAVANByCPPSRAVANByCPP
SRAVANByCPP
 
iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)iPhone development from a Java perspective (Jazoon '09)
iPhone development from a Java perspective (Jazoon '09)
 
C++ language
C++ languageC++ language
C++ language
 
C#2
C#2C#2
C#2
 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1
 
Java Basics
Java BasicsJava Basics
Java Basics
 
Unit 1
Unit  1Unit  1
Unit 1
 
C questions
C questionsC questions
C questions
 
C++ tutorials
C++ tutorialsC++ tutorials
C++ tutorials
 
New microsoft office word document (2)
New microsoft office word document (2)New microsoft office word document (2)
New microsoft office word document (2)
 
C++ Interview Question And Answer
C++ Interview Question And AnswerC++ Interview Question And Answer
C++ Interview Question And Answer
 
C++ questions And Answer
C++ questions And AnswerC++ questions And Answer
C++ questions And Answer
 
C++ Training
C++ TrainingC++ Training
C++ Training
 
Lecture02
Lecture02Lecture02
Lecture02
 
C++ theory
C++ theoryC++ theory
C++ theory
 

More from Sayed Ahmed

Workplace, Data Analytics, and Ethics
Workplace, Data Analytics, and EthicsWorkplace, Data Analytics, and Ethics
Workplace, Data Analytics, and EthicsSayed Ahmed
 
Python py charm anaconda jupyter installation and basic commands
Python py charm anaconda jupyter   installation and basic commandsPython py charm anaconda jupyter   installation and basic commands
Python py charm anaconda jupyter installation and basic commandsSayed Ahmed
 
[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic framework[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic frameworkSayed Ahmed
 
Sap hana-ide-overview-nodev
Sap hana-ide-overview-nodevSap hana-ide-overview-nodev
Sap hana-ide-overview-nodevSayed Ahmed
 
Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction toSayed Ahmed
 
Whm and cpanel overview hosting control panel overview
Whm and cpanel overview   hosting control panel overviewWhm and cpanel overview   hosting control panel overview
Whm and cpanel overview hosting control panel overviewSayed Ahmed
 
Web application development using zend framework
Web application development using zend frameworkWeb application development using zend framework
Web application development using zend frameworkSayed Ahmed
 
Web design and_html_part_3
Web design and_html_part_3Web design and_html_part_3
Web design and_html_part_3Sayed Ahmed
 
Web design and_html_part_2
Web design and_html_part_2Web design and_html_part_2
Web design and_html_part_2Sayed Ahmed
 
Web design and_html
Web design and_htmlWeb design and_html
Web design and_htmlSayed Ahmed
 
Visual studio ide shortcuts
Visual studio ide shortcutsVisual studio ide shortcuts
Visual studio ide shortcutsSayed Ahmed
 
Unit tests in_symfony
Unit tests in_symfonyUnit tests in_symfony
Unit tests in_symfonySayed Ahmed
 
Telerik this is sayed
Telerik this is sayedTelerik this is sayed
Telerik this is sayedSayed Ahmed
 
System analysis and_design
System analysis and_designSystem analysis and_design
System analysis and_designSayed Ahmed
 
Story telling and_narrative
Story telling and_narrativeStory telling and_narrative
Story telling and_narrativeSayed Ahmed
 

More from Sayed Ahmed (20)

Workplace, Data Analytics, and Ethics
Workplace, Data Analytics, and EthicsWorkplace, Data Analytics, and Ethics
Workplace, Data Analytics, and Ethics
 
Python py charm anaconda jupyter installation and basic commands
Python py charm anaconda jupyter   installation and basic commandsPython py charm anaconda jupyter   installation and basic commands
Python py charm anaconda jupyter installation and basic commands
 
[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic framework[not edited] Demo on mobile app development using ionic framework
[not edited] Demo on mobile app development using ionic framework
 
Sap hana-ide-overview-nodev
Sap hana-ide-overview-nodevSap hana-ide-overview-nodev
Sap hana-ide-overview-nodev
 
Invest wisely
Invest wiselyInvest wisely
Invest wisely
 
Will be an introduction to
Will be an introduction toWill be an introduction to
Will be an introduction to
 
Whm and cpanel overview hosting control panel overview
Whm and cpanel overview   hosting control panel overviewWhm and cpanel overview   hosting control panel overview
Whm and cpanel overview hosting control panel overview
 
Web application development using zend framework
Web application development using zend frameworkWeb application development using zend framework
Web application development using zend framework
 
Web design and_html_part_3
Web design and_html_part_3Web design and_html_part_3
Web design and_html_part_3
 
Web design and_html_part_2
Web design and_html_part_2Web design and_html_part_2
Web design and_html_part_2
 
Web design and_html
Web design and_htmlWeb design and_html
Web design and_html
 
Visual studio ide shortcuts
Visual studio ide shortcutsVisual studio ide shortcuts
Visual studio ide shortcuts
 
Virtualization
VirtualizationVirtualization
Virtualization
 
User interfaces
User interfacesUser interfaces
User interfaces
 
Unreal
UnrealUnreal
Unreal
 
Unit tests in_symfony
Unit tests in_symfonyUnit tests in_symfony
Unit tests in_symfony
 
Telerik this is sayed
Telerik this is sayedTelerik this is sayed
Telerik this is sayed
 
System analysis and_design
System analysis and_designSystem analysis and_design
System analysis and_design
 
Symfony 2
Symfony 2Symfony 2
Symfony 2
 
Story telling and_narrative
Story telling and_narrativeStory telling and_narrative
Story telling and_narrative
 

Recently uploaded

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 

Recently uploaded (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 

C++ vs C Differences Guide

  • 1. Sayed Ahmed Just E.T.C Technologies Inc. Just E.T.C. Education Inc.
  • 2.  C++ is based on and an extension to C  Knowing similarities and dissimilarities between C and C++ will help  to select the right language for your application development
  • 3.  Comments:  Header File: #include <iostream>  Namespace: A defined collection of symbols and variable names within an application  The main () function: must have in a program  Parentheses: A function/code block name is followed by Parentheses ()  Braces: Boundary of code blocks
  • 4.  Variables: Used to contain values. Think about variables in Mathematics  Statements: An instruction to the computer hardware to perform specific action.  Statement Terminator: a semicolon  Function calls:  One function can call another function.  It's just a transfer of control from one code block to another code block.  However, the control comes back to the caller again.
  • 5.  #include <iostream>  using namespace std;  int main() {  int studentId;  count << "what is your student ID" << endl;  cin>> studentId;  count << "Student Id " << studentId << endl;  }
  • 6.  A C++ program must have a namespace;  C program ends with .c  where C++ program ends with .cpp  Information communication to and from c program is treated as stream.  cout and cin are used for the purpose  cout and cin are practically objects
  • 7.  To store values  case sensitive  must start with letter  Supportted datatypes: char, int, float, double, boolean, wchar_t  float: usually 32 bits - 6 digit after decimam,  double: 64 bits - 10 digit after decimal,
  • 8.  Can be declared anywhere  Local:  inside functions  Static:  Inside functions but do not get destroyed after  Global:  Declared outside the functions  can be accessed from anywhere in the program  Formal/Parameter  Hidden variable:  if a local variable use the same name of a global variable the local variable = hidden variable  use scope operator :: to access the global variable inside that function
  • 9.  Group of variable  A group of variables of the same type  in c strings are null terminated arrays  C++ also supports a predefined string class/data type;  include <string>
  • 10.  in c, define XYZ 100  in c++, const int val=1000
  • 11.  Enables Code Resuse  Enables Data Security from Unauthorized Access  Object:  Attribute + behaviors  Primary OOP Concepts  Encapsulation:  Inheritance:  - reduce development time  - reuse  -increase maintainability of the code  Polymorphism:  assign different uses to an entity based onthe context  Abstraction:  simple representation of an objet.  hide not essential attributes and behaviors
  • 12.  Object Oriented Paradigm:  Define objects - toughest  define messages  define properties  --define attributes  --define behaviors  Object behavior analysis:  Understand the application  Derive Objects  Categorize Objects  Model process flow
  • 13.  C++ Compliers Must Support: ANSI Standard  Internationalization  Template  Locales  Namespaces
  • 14.  Friend Class  Friend functions and inline functions provide faster, and efficient application  A function can be friend to any number of functions  Use function declaration to declare friend functions  Static Data Members and Static Members  Function - create the common members of classes (across objects)
  • 15.  Constructor  no return types  called at object creation  Destructor  no return type
  • 16.  Operator Overloading  Compile time polymorphism  runtime poly  - inheritance  virtual functions  Operator Overloading:  -unary  -binary  -arithmetic  -assignment  Note: C++ does not support overloading based on return type
  • 17.  Early Binding/Late Binding  Access Modifiers absent = protected
  • 18.  inheritance and destructors  Diamond Problem: Virtual Base Class  Overriding  Pure Virtual Function
  • 19.  manipulators  COUT, setw, right, setfill, flush, endl  fstreambase  fstream  ifstream  ofstream
  • 20.  Mode of file opening  ios::in  ios::out  Sscanf  Read formatted file data  ifstream  fin.getLine()  Random File Reading  seekg  seekp
  • 21.  I/O System  Buffered file system  Stream classes  stream  istream--_IO_istream_withassign  ostream  Iostream  Cin is an instance of _IO_istream_withassign  Instance of _IO_ostream_withassign  cout  cerr
  • 22.  Stream formatting flags  Can be used with setf(), unsetf()  ios::left  ios::dec  ios::fixed  ios::oct  ios::right  ios::scientific  ios::showbase  ios::showpoint  ios::showpos  ios::uppercase
  • 23.  Unformatted input/output  character  character array  strings  use text buffer  Can provide abstraction of the I/O device  functions for unformatted input and output  cin.read()  cin.gcount()  cout.write()
  • 24.  Files  fstreambase  opening, manipulating, closing  fstream, ifstream, ofstream  mode ios::app, ios::ate, ios::binary, ios::in, ios::out, ios::trunc  fin.getline()  Get pointers  Random Operation Put pointers  pointers  Seekg()  Seekp()  Tellg()  Tellp()
  • 25.  Handling Exceptions  runtime errors  Exceptions  try and catch block  throw statement  Uncaught Exceptions  Multiple Catch  ----------  identified by operating systems  if not handled passed to op system exception as int, char ,class strings  how it passes through functions  Derived Class Exceptions  catch block hierarchy  place derived classes catch up
  • 26.  runtime with virtual functions  shape  -draw  rect  tri  define overriding by placing function in each  Show why virtual function needed?  virtual base  pointer runtime polymorphism  pure virtual function  Late binding  base point to base - call derive function - runtime-dynamic
  • 27.  Templates create reusable code  STL provides some foundational items  --templatized functions and  --classes  These can be used to solve a variety of problems  Some STL Elements  Containers  Algorithms  Iterators  STLs are compatible across operating systems
  • 28.  Containers  Vectors  Lists  Maps  Containers  Sequence  Associative
  • 29.  Algorithms  function templates work with container templates of any type  algorithm header file  Iterators are objects to cycle through the containers  iterator header file needs to be included if iterators are used  Iterator type:  Random Access  Bidirectional  Forward  Input  Output
  • 30.  Vector and Array Comparison  container - behave the same way - infinite
  • 31.  Lists: class  Bidirectional linear sequentially  Functions  begin()  end()  erase()  insert(); (template)  push_back();  push_front();  remove();  splice();
  • 32.  Associative Container  Map templates take two parameters  Functions:  begin();  clear();  count();  empty();  end();  erase();  insert();  size()
  • 33.  Working with Templates  Imagine a situation - complex + many data type  Overload may help but time consuming  template can help  object creation define data type  template overloading