Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Recall
• What are files handling used for?
• How do we write in to a file?
• What are the different modes of opening a
file?
• What is fgetc() ?
Introduction to C++
Week 4- day 1
C++
• Super Set of C
C++ was originally developed to be the next version of C, not a new
language.
• Backward compactable with C
Most of the C functions can run in C++
• Same compiler preprocessor
Must have a function names “main” to determine where the program starts
Where they born
Bell Labs
C Vs C++
Similarities
C Vs C++
• int
• Char
• Float
• double
“Exactly the same as
of left side”
Data Types
C Vs C++
• Conditional control
structures
– If
– If else
– Switch
• Loops
– for
– while
– Do while
“Exactly the same as
of left side”
Control Structures
C Vs C++
int sum(int a, int b)
{
Int c;
c=a + b
return c;
}
sum(12,13)
“Exactly the same as
of left side”
functions
C Vs C++
Int a[10];
Int b[] = {1000, 2, 3,
50}; “Exactly the same as
of left side”
Arrays
C Vs C++
Differences
C Vs C++
Output
printf(“ value of a = %d”,a);
Printf(“a = %d and b= %d”,a,b);
Input
scanf(“%d ", &a);
Scanf(“%d”,&a,&b);
Output
cout<< “value of a =" << a;
Cout<<“a =”<<a<<“b=”<<b;
Input
cin>>a;
Cin>>a>>b;;
Input / Output
C Vs C++
char str[10];
str = "Hello!"; //ERROR
char str1[11] = "Call
home!";
char str2[] = "Send
money!";
char str3[] = {'O', 'K',
'0'};
strcat(str1, str2);
string str;
str = "Hello";
string str1("Call
home!");
string str2 = "Send
money!";
string str3("OK");
str = str1 + str2;
str = otherString;
Strings
C Vs C++
struct Data
{
int x;
};
struct Data module;
​module.x = 5;
struct Data
{
int x;
void printMe()
{
cout<<x;
}
} Data;
Data module,Module2;
module.x = 5;
module2.x = 12;
module.printMe() // Prints 5
module.printMe() // Prints 12
Structures
What’s New in C++ ?
• OOP concepts
• Operator overloading
What’s New in C++ ?
OOP Concept
• Object-oriented programming (OOP) is a
style of programming that focuses on
using objects to design and build
applications.
• Think of an object as a model of the
concepts, processes, or things in the real
Objects in real World
Real World
Objects
Objects in real world
• Object will have an identity/name
 Eg: reynolds, Cello for pen. Nokia,apple for
mobile
• Object will have different properties which
describes them best
 Eg:Color,size,width
• Object can perform different actions
 Eg: writing,erasing etc for pen. Calling,
Objects
I have an identity:
I'm Volkswagen
I have different properties.
My color property is green
My no:of wheel property is 4
I can perform different actions
I can be drived
I can consume fuel
I can play Music
I have an identity:
I'm Suzuki
I have different properties.
My color property is silver
My no:of wheel property is 4
I can perform different actions
I can be drived
I can consume fuel
I can play Music
How these objects are created?
• All the objects in the real world are created
out of a basic prototype or a basic blue
print or a base design
Objects in software World
Objects in the software world
• Same like in the real world we can create
objects in computer programming world
–Which will have a name as identity
–Properties to define its behaviour
–Actions what it can perform
How these objects are
created
• We need to create a base design which
defines the properties and functionalities
that the object should have.
• In programming terms we call this base
design as Class
• Simply by having a class we can create
any number of objects of that type
Definition
• Class : is the base design of
objects
• Object : is the instance of a class
• No memory is allocated when a class is
created.
• Memory is allocated only when an object is
created.
How to create class in
C++
class shape
{
Int width;
Int height;
Int calculateArea()
{
return x*y
}
}
public:
How to create class in
C++
class shape
{
Int width;
Int height;
Int calculateArea()
{
return x*y
}
}
Is the Keyword to create
any class
public:
How to create class in
C++
class shape
{
Int width;
Int height;
Int calculateArea()
{
return x*y
}
}
Is the name of the class
public:
How to create class in
C++
class shape
{
Int width;
Int height;
Int calculateArea()
{
return x*y
}
}
Called access specifier.
Will detailed soonpublic:
How to create class in
C++
class shape
{
Int width;
Int height;
Int calculateArea()
{
return x*y
}
}
Are two variable that
referred as the
properties
public:
How to create class in
C++
class shape
{
Int width;
Int height;
Int calculateArea()
{
return x*y
}
}
Is the only functionality
of this class
public:
How to create objects in
C++
shape rectangle,square;
rectangle.width=20;
recangle.height=35;
square.height=10;
square.width=10;
rArea=rectangle.calculateArea();
sArea=square.calculateArea();
Is the class name
How to create objects in
C++
shape rectangle,square;
rectangle.width=20;
recangle.height=35;
square.height=10;
square.width=10;
rArea=rectangle.calculateArea();
sArea=square.calculateArea();
Two objects of base type
shape
How to create objects in
C++
shape rectangle,square;
rectangle.width=20;
recangle.height=35;
square.height=10;
square.width=10;
rArea=rectangle.calculateArea();
sArea=square.calculateArea();
Setting properties of
object named rectangle
How to create objects in
C++
shape rectangle,square;
rectangle.width=20;
recangle.height=35;
square.height=10;
square.width=10;
rArea=rectangle.calculateArea();
sArea=square.calculateArea();
Setting properties of
object named square
How to create objects in
C++
shape rectangle,square;
rectangle.width=20;
recangle.height=35;
square.height=10;
square.width=10;
rArea=rectangle.calculateArea();
sArea=square.calculateArea();
Calling the functionality
of rectangle which is
claclulateArea();
How to create objects in
C++
shape rectangle,square;
rectangle.width=20;
recangle.height=35;
square.height=10;
square.width=10;
rArea=rectangle.calculateArea();
sArea=square.calculateArea();
Calling the functionality
of rectangle which is
claclulateArea();
Example
Class : shape
Height:35
width:20
Object rectangle
calculateArea()
{
Return 20*35
}
Height:10
width:10
Object square
calculateArea()
{
Return 10*10;
}
Member variables
Height
width
Member function
calculateArea
{
return height*width;
}
Access Specifier
• Access specifiers defines the access
rights for the statements or functions that
follows it until another access specifier or
till the end of a class.
• The three types of access specifiers are
–Private
–Public
–Protected
Access Specifier
class Base
{
public:
// public members go here
protected:
// protected members go here
private:
// private members go here
};
Class Vs Structure
• Class is similar to Structure.
• Structure members have public access by
default.
• Class members have private access by
default.
Self Check !!
Self Check
• Which of the following term is used for a
function defined inside a class?
–Member Variable
–Member function
–Class function
–Classic function
Self Check
• Which of the following term is used for a
function defined inside a class?
–Member Variable
–Member function
–Class function
–Classic function
Self Check
• cout is a/an __________ .
–Operator
–Function
–Object
–macro
Self Check
• cout is a/an __________ .
–Operator
–Function
–Object
–macro
Self Check
• Which of the following is correct about
class and structure?
– class can have member functions while
structure cannot.
– class data members are public by default
while that of structure are private.
– Pointer to structure or classes cannot be
declared.
– class data members are private by default
while that of structure are public by default.
Self Check
• Which of the following is correct about
class and structure?
– class can have member functions while
structure cannot.
– class data members are public by default
while that of structure are private.
– Pointer to structure or classes cannot be
declared.
– class data members are private by default
while that of structure are public by default.
Self Check
• Which of the following operator is
overloaded for object cout?
•>>
•<<
•+
•=
Self Check
• Which of the following operator is
overloaded for object cout?
•>>
•<<
•+
•=
Self Check
• Which of the following access
specifier is used as a default in a
class definition?
•protected
•public
•private
•friend
Self Check
• Which of the following access
specifier is used as a default in a
class definition?
•protected
•public
•private
•friend
End of Day

More Related Content

What's hot

Java01
Java01Java01
Java01
Remon Hanna
 
C++ overview
C++ overviewC++ overview
C++ overview
Prem Ranjan
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
Unmesh Baile
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scala
Ruslan Shevchenko
 
24csharp
24csharp24csharp
24csharp
Sireesh K
 
Design Without Types
Design Without TypesDesign Without Types
Design Without Types
Alexandru Bolboaca
 
Demystifying Shapeless
Demystifying Shapeless Demystifying Shapeless
Demystifying Shapeless
Jared Roesch
 
Scala jargon cheatsheet
Scala jargon cheatsheetScala jargon cheatsheet
Scala jargon cheatsheet
Ruslan Shevchenko
 
Object concepts
Object conceptsObject concepts
Object concepts
Aashima Wadhwa
 
Sep 15
Sep 15Sep 15
Sep 15
Zia Akbar
 
Sep 15
Sep 15Sep 15
Sep 15
dilipseervi
 
Ruby :: Training 1
Ruby :: Training 1Ruby :: Training 1
Ruby :: Training 1
Pavel Tyk
 
Java
JavaJava
Building a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot PotatoBuilding a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot Potato
MongoDB
 

What's hot (14)

Java01
Java01Java01
Java01
 
C++ overview
C++ overviewC++ overview
C++ overview
 
java-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbaijava-corporate-training-institute-in-mumbai
java-corporate-training-institute-in-mumbai
 
Few simple-type-tricks in scala
Few simple-type-tricks in scalaFew simple-type-tricks in scala
Few simple-type-tricks in scala
 
24csharp
24csharp24csharp
24csharp
 
Design Without Types
Design Without TypesDesign Without Types
Design Without Types
 
Demystifying Shapeless
Demystifying Shapeless Demystifying Shapeless
Demystifying Shapeless
 
Scala jargon cheatsheet
Scala jargon cheatsheetScala jargon cheatsheet
Scala jargon cheatsheet
 
Object concepts
Object conceptsObject concepts
Object concepts
 
Sep 15
Sep 15Sep 15
Sep 15
 
Sep 15
Sep 15Sep 15
Sep 15
 
Ruby :: Training 1
Ruby :: Training 1Ruby :: Training 1
Ruby :: Training 1
 
Java
JavaJava
Java
 
Building a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot PotatoBuilding a Mongo DSL in Scala at Hot Potato
Building a Mongo DSL in Scala at Hot Potato
 

Similar to Introduction to c ++ part -1

CPP13 - Object Orientation
CPP13 - Object OrientationCPP13 - Object Orientation
CPP13 - Object Orientation
Michael Heron
 
Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
Abdullah Jan
 
Introduction to java and oop
Introduction to java and oopIntroduction to java and oop
lecture_for programming and computing basics
lecture_for programming and computing basicslecture_for programming and computing basics
lecture_for programming and computing basics
JavedKhan524377
 
CPP15 - Inheritance
CPP15 - InheritanceCPP15 - Inheritance
CPP15 - Inheritance
Michael Heron
 
Introducing object oriented programming (oop)
Introducing object oriented programming (oop)Introducing object oriented programming (oop)
Introducing object oriented programming (oop)
Hemlathadhevi Annadhurai
 
CPP02 - The Structure of a Program
CPP02 - The Structure of a ProgramCPP02 - The Structure of a Program
CPP02 - The Structure of a Program
Michael Heron
 
2CPP13 - Operator Overloading
2CPP13 - Operator Overloading2CPP13 - Operator Overloading
2CPP13 - Operator Overloading
Michael Heron
 
2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation Fundamentals2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation Fundamentals
Michael Heron
 
C++ Introduction brown bag
C++ Introduction brown bagC++ Introduction brown bag
C++ Introduction brown bag
Jacob Green
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++
jehan1987
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introduction
Sireesh K
 
Learn c++ Programming Language
Learn c++ Programming LanguageLearn c++ Programming Language
Learn c++ Programming Language
Steve Johnson
 
Frederick web meetup slides
Frederick web meetup slidesFrederick web meetup slides
Frederick web meetup slides
Pat Zearfoss
 
Intro to Objective C
Intro to Objective CIntro to Objective C
Intro to Objective C
Ashiq Uz Zoha
 
Summer Training Project On C++
Summer Training Project On  C++Summer Training Project On  C++
Summer Training Project On C++
KAUSHAL KUMAR JHA
 
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptxstatic MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
urvashipundir04
 
static members in object oriented program.pptx
static members in object oriented program.pptxstatic members in object oriented program.pptx
static members in object oriented program.pptx
urvashipundir04
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
nikshaikh786
 
C++ - Constructors,Destructors, Operator overloading and Type conversion
C++ - Constructors,Destructors, Operator overloading and Type conversionC++ - Constructors,Destructors, Operator overloading and Type conversion
C++ - Constructors,Destructors, Operator overloading and Type conversion
Hashni T
 

Similar to Introduction to c ++ part -1 (20)

CPP13 - Object Orientation
CPP13 - Object OrientationCPP13 - Object Orientation
CPP13 - Object Orientation
 
Concept of Object-Oriented in C++
Concept of Object-Oriented in C++Concept of Object-Oriented in C++
Concept of Object-Oriented in C++
 
Introduction to java and oop
Introduction to java and oopIntroduction to java and oop
Introduction to java and oop
 
lecture_for programming and computing basics
lecture_for programming and computing basicslecture_for programming and computing basics
lecture_for programming and computing basics
 
CPP15 - Inheritance
CPP15 - InheritanceCPP15 - Inheritance
CPP15 - Inheritance
 
Introducing object oriented programming (oop)
Introducing object oriented programming (oop)Introducing object oriented programming (oop)
Introducing object oriented programming (oop)
 
CPP02 - The Structure of a Program
CPP02 - The Structure of a ProgramCPP02 - The Structure of a Program
CPP02 - The Structure of a Program
 
2CPP13 - Operator Overloading
2CPP13 - Operator Overloading2CPP13 - Operator Overloading
2CPP13 - Operator Overloading
 
2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation Fundamentals2CPP03 - Object Orientation Fundamentals
2CPP03 - Object Orientation Fundamentals
 
C++ Introduction brown bag
C++ Introduction brown bagC++ Introduction brown bag
C++ Introduction brown bag
 
Object oriented programming in C++
Object oriented programming in C++Object oriented programming in C++
Object oriented programming in C++
 
Csharp introduction
Csharp introductionCsharp introduction
Csharp introduction
 
Learn c++ Programming Language
Learn c++ Programming LanguageLearn c++ Programming Language
Learn c++ Programming Language
 
Frederick web meetup slides
Frederick web meetup slidesFrederick web meetup slides
Frederick web meetup slides
 
Intro to Objective C
Intro to Objective CIntro to Objective C
Intro to Objective C
 
Summer Training Project On C++
Summer Training Project On  C++Summer Training Project On  C++
Summer Training Project On C++
 
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptxstatic MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
static MEMBER IN OOPS PROGRAMING LANGUAGE.pptx
 
static members in object oriented program.pptx
static members in object oriented program.pptxstatic members in object oriented program.pptx
static members in object oriented program.pptx
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
 
C++ - Constructors,Destructors, Operator overloading and Type conversion
C++ - Constructors,Destructors, Operator overloading and Type conversionC++ - Constructors,Destructors, Operator overloading and Type conversion
C++ - Constructors,Destructors, Operator overloading and Type conversion
 

More from baabtra.com - No. 1 supplier of quality freshers

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
Best coding practices
Best coding practicesBest coding practices
Core java - baabtra
Core java - baabtraCore java - baabtra
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php database connectivity
Php database connectivityPhp database connectivity
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Blue brain
Blue brainBlue brain
5g
5g5g
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Gd baabtra
Gd baabtraGd baabtra

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Recently uploaded

“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
Edge AI and Vision Alliance
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 
What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)
Margaret Fero
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
jackson110191
 
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
uuuot
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)
apoorva2579
 
Performance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy EvertsPerformance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy Everts
ScyllaDB
 
GDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
GDG Cloud Southlake #34: Neatsun Ziv: Automating AppsecGDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
GDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
James Anderson
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
The Digital Insurer
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Mydbops
 
this resume for sadika shaikh bca student
this resume for sadika shaikh bca studentthis resume for sadika shaikh bca student
this resume for sadika shaikh bca student
SadikaShaikh7
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
Aurora Consulting
 
Blockchain and Cyber Defense Strategies in new genre times
Blockchain and Cyber Defense Strategies in new genre timesBlockchain and Cyber Defense Strategies in new genre times
Blockchain and Cyber Defense Strategies in new genre times
anupriti
 
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & SolutionsMYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
Linda Zhang
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
UiPathCommunity
 
HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)
Alpen-Adria-Universität
 
STKI Israeli Market Study 2024 final v1
STKI Israeli Market Study 2024 final  v1STKI Israeli Market Study 2024 final  v1
STKI Israeli Market Study 2024 final v1
Dr. Jimmy Schwarzkopf
 

Recently uploaded (20)

“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
“Intel’s Approach to Operationalizing AI in the Manufacturing Sector,” a Pres...
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 
What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)What Not to Document and Why_ (North Bay Python 2024)
What Not to Document and Why_ (North Bay Python 2024)
 
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdfINDIAN AIR FORCE FIGHTER PLANES LIST.pdf
INDIAN AIR FORCE FIGHTER PLANES LIST.pdf
 
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
一比一原版(msvu毕业证书)圣文森山大学毕业证如何办理
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)AC Atlassian Coimbatore Session Slides( 22/06/2024)
AC Atlassian Coimbatore Session Slides( 22/06/2024)
 
Performance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy EvertsPerformance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy Everts
 
GDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
GDG Cloud Southlake #34: Neatsun Ziv: Automating AppsecGDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
GDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - MydbopsScaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
Scaling Connections in PostgreSQL Postgres Bangalore(PGBLR) Meetup-2 - Mydbops
 
this resume for sadika shaikh bca student
this resume for sadika shaikh bca studentthis resume for sadika shaikh bca student
this resume for sadika shaikh bca student
 
Quality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of TimeQuality Patents: Patents That Stand the Test of Time
Quality Patents: Patents That Stand the Test of Time
 
Blockchain and Cyber Defense Strategies in new genre times
Blockchain and Cyber Defense Strategies in new genre timesBlockchain and Cyber Defense Strategies in new genre times
Blockchain and Cyber Defense Strategies in new genre times
 
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & SolutionsMYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
MYIR Product Brochure - A Global Provider of Embedded SOMs & Solutions
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
 
HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)
 
STKI Israeli Market Study 2024 final v1
STKI Israeli Market Study 2024 final  v1STKI Israeli Market Study 2024 final  v1
STKI Israeli Market Study 2024 final v1
 

Introduction to c ++ part -1

  • 1. Recall • What are files handling used for? • How do we write in to a file? • What are the different modes of opening a file? • What is fgetc() ?
  • 3. C++ • Super Set of C C++ was originally developed to be the next version of C, not a new language. • Backward compactable with C Most of the C functions can run in C++ • Same compiler preprocessor Must have a function names “main” to determine where the program starts
  • 6. C Vs C++ • int • Char • Float • double “Exactly the same as of left side” Data Types
  • 7. C Vs C++ • Conditional control structures – If – If else – Switch • Loops – for – while – Do while “Exactly the same as of left side” Control Structures
  • 8. C Vs C++ int sum(int a, int b) { Int c; c=a + b return c; } sum(12,13) “Exactly the same as of left side” functions
  • 9. C Vs C++ Int a[10]; Int b[] = {1000, 2, 3, 50}; “Exactly the same as of left side” Arrays
  • 11. C Vs C++ Output printf(“ value of a = %d”,a); Printf(“a = %d and b= %d”,a,b); Input scanf(“%d ", &a); Scanf(“%d”,&a,&b); Output cout<< “value of a =" << a; Cout<<“a =”<<a<<“b=”<<b; Input cin>>a; Cin>>a>>b;; Input / Output
  • 12. C Vs C++ char str[10]; str = "Hello!"; //ERROR char str1[11] = "Call home!"; char str2[] = "Send money!"; char str3[] = {'O', 'K', '0'}; strcat(str1, str2); string str; str = "Hello"; string str1("Call home!"); string str2 = "Send money!"; string str3("OK"); str = str1 + str2; str = otherString; Strings
  • 13. C Vs C++ struct Data { int x; }; struct Data module; ​module.x = 5; struct Data { int x; void printMe() { cout<<x; } } Data; Data module,Module2; module.x = 5; module2.x = 12; module.printMe() // Prints 5 module.printMe() // Prints 12 Structures
  • 15. • OOP concepts • Operator overloading What’s New in C++ ?
  • 16. OOP Concept • Object-oriented programming (OOP) is a style of programming that focuses on using objects to design and build applications. • Think of an object as a model of the concepts, processes, or things in the real
  • 19. Objects in real world • Object will have an identity/name  Eg: reynolds, Cello for pen. Nokia,apple for mobile • Object will have different properties which describes them best  Eg:Color,size,width • Object can perform different actions  Eg: writing,erasing etc for pen. Calling,
  • 20. Objects I have an identity: I'm Volkswagen I have different properties. My color property is green My no:of wheel property is 4 I can perform different actions I can be drived I can consume fuel I can play Music I have an identity: I'm Suzuki I have different properties. My color property is silver My no:of wheel property is 4 I can perform different actions I can be drived I can consume fuel I can play Music
  • 21. How these objects are created? • All the objects in the real world are created out of a basic prototype or a basic blue print or a base design
  • 23. Objects in the software world • Same like in the real world we can create objects in computer programming world –Which will have a name as identity –Properties to define its behaviour –Actions what it can perform
  • 24. How these objects are created • We need to create a base design which defines the properties and functionalities that the object should have. • In programming terms we call this base design as Class • Simply by having a class we can create any number of objects of that type
  • 25. Definition • Class : is the base design of objects • Object : is the instance of a class • No memory is allocated when a class is created. • Memory is allocated only when an object is created.
  • 26. How to create class in C++ class shape { Int width; Int height; Int calculateArea() { return x*y } } public:
  • 27. How to create class in C++ class shape { Int width; Int height; Int calculateArea() { return x*y } } Is the Keyword to create any class public:
  • 28. How to create class in C++ class shape { Int width; Int height; Int calculateArea() { return x*y } } Is the name of the class public:
  • 29. How to create class in C++ class shape { Int width; Int height; Int calculateArea() { return x*y } } Called access specifier. Will detailed soonpublic:
  • 30. How to create class in C++ class shape { Int width; Int height; Int calculateArea() { return x*y } } Are two variable that referred as the properties public:
  • 31. How to create class in C++ class shape { Int width; Int height; Int calculateArea() { return x*y } } Is the only functionality of this class public:
  • 32. How to create objects in C++ shape rectangle,square; rectangle.width=20; recangle.height=35; square.height=10; square.width=10; rArea=rectangle.calculateArea(); sArea=square.calculateArea(); Is the class name
  • 33. How to create objects in C++ shape rectangle,square; rectangle.width=20; recangle.height=35; square.height=10; square.width=10; rArea=rectangle.calculateArea(); sArea=square.calculateArea(); Two objects of base type shape
  • 34. How to create objects in C++ shape rectangle,square; rectangle.width=20; recangle.height=35; square.height=10; square.width=10; rArea=rectangle.calculateArea(); sArea=square.calculateArea(); Setting properties of object named rectangle
  • 35. How to create objects in C++ shape rectangle,square; rectangle.width=20; recangle.height=35; square.height=10; square.width=10; rArea=rectangle.calculateArea(); sArea=square.calculateArea(); Setting properties of object named square
  • 36. How to create objects in C++ shape rectangle,square; rectangle.width=20; recangle.height=35; square.height=10; square.width=10; rArea=rectangle.calculateArea(); sArea=square.calculateArea(); Calling the functionality of rectangle which is claclulateArea();
  • 37. How to create objects in C++ shape rectangle,square; rectangle.width=20; recangle.height=35; square.height=10; square.width=10; rArea=rectangle.calculateArea(); sArea=square.calculateArea(); Calling the functionality of rectangle which is claclulateArea();
  • 38. Example Class : shape Height:35 width:20 Object rectangle calculateArea() { Return 20*35 } Height:10 width:10 Object square calculateArea() { Return 10*10; } Member variables Height width Member function calculateArea { return height*width; }
  • 39. Access Specifier • Access specifiers defines the access rights for the statements or functions that follows it until another access specifier or till the end of a class. • The three types of access specifiers are –Private –Public –Protected
  • 40. Access Specifier class Base { public: // public members go here protected: // protected members go here private: // private members go here };
  • 41. Class Vs Structure • Class is similar to Structure. • Structure members have public access by default. • Class members have private access by default.
  • 43. Self Check • Which of the following term is used for a function defined inside a class? –Member Variable –Member function –Class function –Classic function
  • 44. Self Check • Which of the following term is used for a function defined inside a class? –Member Variable –Member function –Class function –Classic function
  • 45. Self Check • cout is a/an __________ . –Operator –Function –Object –macro
  • 46. Self Check • cout is a/an __________ . –Operator –Function –Object –macro
  • 47. Self Check • Which of the following is correct about class and structure? – class can have member functions while structure cannot. – class data members are public by default while that of structure are private. – Pointer to structure or classes cannot be declared. – class data members are private by default while that of structure are public by default.
  • 48. Self Check • Which of the following is correct about class and structure? – class can have member functions while structure cannot. – class data members are public by default while that of structure are private. – Pointer to structure or classes cannot be declared. – class data members are private by default while that of structure are public by default.
  • 49. Self Check • Which of the following operator is overloaded for object cout? •>> •<< •+ •=
  • 50. Self Check • Which of the following operator is overloaded for object cout? •>> •<< •+ •=
  • 51. Self Check • Which of the following access specifier is used as a default in a class definition? •protected •public •private •friend
  • 52. Self Check • Which of the following access specifier is used as a default in a class definition? •protected •public •private •friend