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
Β 
Taking User Input in Java
Taking User Input in JavaTaking User Input in Java
Taking User Input in JavaEftakhairul Islam
Β 
Buffer and scanner
Buffer and scannerBuffer and scanner
Buffer and scannerArif Ullah
Β 
Java 8 lambda
Java 8 lambdaJava 8 lambda
Java 8 lambdaManav Prasad
Β 
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
Β 
Java input
Java inputJava input
Java inputJin Castor
Β 
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
Β 
Java vs kotlin
Java vs kotlinJava vs kotlin
Java vs kotlinDeesha Vora
Β 
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++ language
C++ languageC++ language
C++ languageHamza Asif
Β 
C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1C, C++ Interview Questions Part - 1
C, C++ Interview Questions Part - 1ReKruiTIn.com
Β 
Unit 1
Unit  1Unit  1
Unit 1donny101
Β 
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
Β 
C++ theory
C++ theoryC++ theory
C++ theoryShyam Khant
Β 

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
Β 
Invest wisely
Invest wiselyInvest wisely
Invest wiselySayed 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
Β 
Virtualization
VirtualizationVirtualization
VirtualizationSayed Ahmed
Β 
User interfaces
User interfacesUser interfaces
User interfacesSayed 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

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
Β 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
Β 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
Β 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
Β 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
Β 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
Β 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
Β 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
Β 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
Β 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
Β 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
Β 
Integration and Automation in Practice: CI/CD in MuleΒ Integration and Automat...
Integration and Automation in Practice: CI/CD in MuleΒ Integration and Automat...Integration and Automation in Practice: CI/CD in MuleΒ Integration and Automat...
Integration and Automation in Practice: CI/CD in MuleΒ Integration and Automat...Patryk Bandurski
Β 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
Β 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo GarcΓ­a Lavilla
Β 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
Β 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
Β 
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
Β 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
Β 

Recently uploaded (20)

"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
Β 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
Β 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
Β 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
Β 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
Β 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
Β 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Β 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
Β 
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
Β 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Β 
Hot Sexy call girls in Panjabi Bagh πŸ” 9953056974 πŸ” Delhi escort Service
Hot Sexy call girls in Panjabi Bagh πŸ” 9953056974 πŸ” Delhi escort ServiceHot Sexy call girls in Panjabi Bagh πŸ” 9953056974 πŸ” Delhi escort Service
Hot Sexy call girls in Panjabi Bagh πŸ” 9953056974 πŸ” Delhi escort Service
Β 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
Β 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
Β 
Integration and Automation in Practice: CI/CD in MuleΒ Integration and Automat...
Integration and Automation in Practice: CI/CD in MuleΒ Integration and Automat...Integration and Automation in Practice: CI/CD in MuleΒ Integration and Automat...
Integration and Automation in Practice: CI/CD in MuleΒ Integration and Automat...
Β 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
Β 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
Β 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
Β 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
Β 
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
Β 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Β 

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