SlideShare una empresa de Scribd logo
1 de 14
Object Oriented Programming: 7
First Steps in OOP using C++
Prof Neeraj Bhargava
Vaibhav Khanna
Department of Computer Science
School of Engineering and Systems Sciences
Maharshi Dayanand Saraswati University Ajmer
Benefits of OOP
• Through inheritance, we can eliminate redundant code extend the
use of existing
• Classes.
• We can build programs from the standard working modules that
communicate with one another, rather than having to start writing
the code from scratch.
• This leads to saving of development time and higher productivity.
• The principle of data hiding helps the programmer to build secure
program that can not be invaded by code in other parts of a
programs.
• It is possible to have multiple instances of an object to co-exist
without any interference.
Benefits of OOP
• It is possible to map object in the problem domain to
those in the program.
• It is easy to partition the work in a project based on
objects.
• The data-centered design approach enables us to
capture more detail of a model can implemental form.
• Object-oriented system can be easily upgraded from
small to large system.
• Message passing techniques for communication
between objects makes to interface descriptions with
external systems much simpler.
• Software complexity can be easily managed.
Application of OOP
• Real-time system
• Simulation and modeling
• Object-oriented data bases
• Hypertext, Hypermedia, and expert system
• AI and expert systems
• Neural networks and parallel programming
• Decision support and office automation systems
• CIM/CAM/CAD systems
Introduction of C++
• C++ is an object-oriented programming language.
• It was developed by Bjarne Stroustrup at AT&T Bell Laboratories in
Murray Hill, New Jersey, USA, in the early 1980’s.
• Stroustrup, an admirer of Simula67 and a strong supporter of C,
wanted to combine the best of both the languages and create a
more powerful language that could support object-oriented
programming features and still retain the power and elegance of C.
• The result was C++. Therefore, C++ is an extension of C with a major
addition of the class construct feature of Simula67.
• Since the class was a major addition to the original C language,
Stroustrup initially called the new language ‘C with classes’.
• However, later in 1983, the name was changed to C++. The idea of
C++ comes from the C increment operator ++, thereby suggesting
that C++ is an augmented version of C.
Introduction of C++
• The most important facilities that C++ adds on
to C are
– classes, inheritance,
– function overloading and
– operator overloading.
– These features enable creating of abstract data
types,
– inherit properties from existing data types and
support polymorphism, thereby making C++ a
truly object-oriented language.
Printing A String in C++
• #include<iostream>
• Using namespace std;
• int main()
• {
• cout<< “c++ is a very powerful Object
Oriented Programming Language n” ;
• return 0;
• }
Program feature
• Like C, the C++ program is a collection of
function.
• The above example contain only one function
main(). As usual execution begins at main().
• Every C++ program must have a main().
• C++ is a free form language.
• With a few exception, the compiler ignore
carriage return and white spaces.
• Like C, the C++ statements terminate with
semicolons.
Comments
• C++ comment symbol // (double slash) is used for single line
comments
• Comment start with a double slash symbol and terminate at the
end of the line.
• A comment may start anywhere in the line, and whatever follows
till the end of the line is ignored. (Note that there is no closing
symbol)
• The C comment symbols /*, */ are still valid and are more
suitable for multiline comments. The following comment is allowed:
• /* This is an example of
• C++ program to illustrate
• some of its features
• */
Output operator
• cout<< “c++ is a very powerful Object Oriented
Programming Language n” ;
• Causes the string in quotation marks to be displayed on the
screen.
• This statement introduces two new C++ features, cout and
<<.
• The identifier cout (pronounced as C out) is a predefined
object that represents the standard output stream in C++.
• Here, the standard output stream represents the screen.
• The operator << is called the insertion (or put to) operator
The iostream File
• We have used the following #include directive
in the program:
• #include <iostream>
• The #include directive instructs the compiler
to include the contents of the file enclosed
within angular brackets into the source file.
Namespace
• Namespace is a new concept introduced by the ANSI C++
standards committee.
• This defines a scope for the identifiers that are used in a
program. For using the identifier defined in the namespace
scope we must include the using directive, like
– Using namespace std;
• Here, std is the namespace where ANSI C++ standard class
libraries are defined.
• All ANSI C++ programs must include this directive.
• This will bring all the identifiers defined in std to the
current global scope.
• Using and namespace are the new keyword of C++.
Return Type of main()
• In C++, main () returns an integer value to the
operating system.
• Therefore, every main () in C++ should end
with a return (0) statement; otherwise a
warning an error might occur.
• Since main () returns an integer type for main
() is explicitly specified as int.
• Note that the default return type for all
function in C++ is int.
Assignment
• Discuss the benefits and applications of object
oriented programming
• Write a C++ program to print a string “Hello
World” on the console output. Briefly Explain
the elements of the program.

Más contenido relacionado

La actualidad más candente

Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
Kumar
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
Tech_MX
 

La actualidad más candente (20)

Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Managing console input and output
Managing console input and outputManaging console input and output
Managing console input and output
 
Files in c++ ppt
Files in c++ pptFiles in c++ ppt
Files in c++ ppt
 
Advance oops concepts
Advance oops conceptsAdvance oops concepts
Advance oops concepts
 
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
Inheritance in c++ ppt (Powerpoint) | inheritance in c++ ppt presentation | i...
 
Function overloading(c++)
Function overloading(c++)Function overloading(c++)
Function overloading(c++)
 
Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function Virtual function in C++ Pure Virtual Function
Virtual function in C++ Pure Virtual Function
 
Inheritance in c++
Inheritance in c++Inheritance in c++
Inheritance in c++
 
Constructor and destructor
Constructor  and  destructor Constructor  and  destructor
Constructor and destructor
 
Function overloading
Function overloadingFunction overloading
Function overloading
 
Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
 
Object oriented programming c++
Object oriented programming c++Object oriented programming c++
Object oriented programming c++
 
Constructors and destructors
Constructors and destructorsConstructors and destructors
Constructors and destructors
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Constructor and Types of Constructors
Constructor and Types of ConstructorsConstructor and Types of Constructors
Constructor and Types of Constructors
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)Basic Concepts of OOPs (Object Oriented Programming in Java)
Basic Concepts of OOPs (Object Oriented Programming in Java)
 
Kotlin Language powerpoint show file
Kotlin Language powerpoint show fileKotlin Language powerpoint show file
Kotlin Language powerpoint show file
 
OOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOPOOP - Benefits and advantages of OOP
OOP - Benefits and advantages of OOP
 
inheritance c++
inheritance c++inheritance c++
inheritance c++
 
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
C++ Inheritance Tutorial | Introduction To Inheritance In C++ Programming Wit...
 

Similar a Object oriented programming 7 first steps in oop using c++

Similar a Object oriented programming 7 first steps in oop using c++ (20)

C++ vs C#
C++ vs C#C++ vs C#
C++ vs C#
 
Introduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to itIntroduction to cpp language and all the required information relating to it
Introduction to cpp language and all the required information relating to it
 
Introduction Of C++
Introduction Of C++Introduction Of C++
Introduction Of C++
 
Unit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introductionUnit 1 of c++ part 1 basic introduction
Unit 1 of c++ part 1 basic introduction
 
Basics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptxBasics of C Lecture 2[16097].pptx
Basics of C Lecture 2[16097].pptx
 
C++ language basic
C++ language basicC++ language basic
C++ language basic
 
C language unit-1
C language unit-1C language unit-1
C language unit-1
 
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDYC LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
 
C languaGE UNIT-1
C languaGE UNIT-1C languaGE UNIT-1
C languaGE UNIT-1
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Oops index
Oops indexOops index
Oops index
 
Unit ii
Unit   iiUnit   ii
Unit ii
 
Learning the C Language
Learning the C LanguageLearning the C Language
Learning the C Language
 
Chapter 1: Introduction
Chapter 1: IntroductionChapter 1: Introduction
Chapter 1: Introduction
 
Introduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdfIntroduction-to-C-Part-1.pdf
Introduction-to-C-Part-1.pdf
 
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTREC & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
C & C++ Training Centre in Ambala! BATRA COMPUTER CENTRE
 
Csc240 -lecture_3
Csc240  -lecture_3Csc240  -lecture_3
Csc240 -lecture_3
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
 
490450755-Chapter-2.ppt
490450755-Chapter-2.ppt490450755-Chapter-2.ppt
490450755-Chapter-2.ppt
 
Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)Introduction to C Language (By: Shujaat Abbas)
Introduction to C Language (By: Shujaat Abbas)
 

Más de Vaibhav Khanna

Más de Vaibhav Khanna (20)

Information and network security 47 authentication applications
Information and network security 47 authentication applicationsInformation and network security 47 authentication applications
Information and network security 47 authentication applications
 
Information and network security 46 digital signature algorithm
Information and network security 46 digital signature algorithmInformation and network security 46 digital signature algorithm
Information and network security 46 digital signature algorithm
 
Information and network security 45 digital signature standard
Information and network security 45 digital signature standardInformation and network security 45 digital signature standard
Information and network security 45 digital signature standard
 
Information and network security 44 direct digital signatures
Information and network security 44 direct digital signaturesInformation and network security 44 direct digital signatures
Information and network security 44 direct digital signatures
 
Information and network security 43 digital signatures
Information and network security 43 digital signaturesInformation and network security 43 digital signatures
Information and network security 43 digital signatures
 
Information and network security 42 security of message authentication code
Information and network security 42 security of message authentication codeInformation and network security 42 security of message authentication code
Information and network security 42 security of message authentication code
 
Information and network security 41 message authentication code
Information and network security 41 message authentication codeInformation and network security 41 message authentication code
Information and network security 41 message authentication code
 
Information and network security 40 sha3 secure hash algorithm
Information and network security 40 sha3 secure hash algorithmInformation and network security 40 sha3 secure hash algorithm
Information and network security 40 sha3 secure hash algorithm
 
Information and network security 39 secure hash algorithm
Information and network security 39 secure hash algorithmInformation and network security 39 secure hash algorithm
Information and network security 39 secure hash algorithm
 
Information and network security 38 birthday attacks and security of hash fun...
Information and network security 38 birthday attacks and security of hash fun...Information and network security 38 birthday attacks and security of hash fun...
Information and network security 38 birthday attacks and security of hash fun...
 
Information and network security 37 hash functions and message authentication
Information and network security 37 hash functions and message authenticationInformation and network security 37 hash functions and message authentication
Information and network security 37 hash functions and message authentication
 
Information and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theoremInformation and network security 35 the chinese remainder theorem
Information and network security 35 the chinese remainder theorem
 
Information and network security 34 primality
Information and network security 34 primalityInformation and network security 34 primality
Information and network security 34 primality
 
Information and network security 33 rsa algorithm
Information and network security 33 rsa algorithmInformation and network security 33 rsa algorithm
Information and network security 33 rsa algorithm
 
Information and network security 32 principles of public key cryptosystems
Information and network security 32 principles of public key cryptosystemsInformation and network security 32 principles of public key cryptosystems
Information and network security 32 principles of public key cryptosystems
 
Information and network security 31 public key cryptography
Information and network security 31 public key cryptographyInformation and network security 31 public key cryptography
Information and network security 31 public key cryptography
 
Information and network security 30 random numbers
Information and network security 30 random numbersInformation and network security 30 random numbers
Information and network security 30 random numbers
 
Information and network security 29 international data encryption algorithm
Information and network security 29 international data encryption algorithmInformation and network security 29 international data encryption algorithm
Information and network security 29 international data encryption algorithm
 
Information and network security 28 blowfish
Information and network security 28 blowfishInformation and network security 28 blowfish
Information and network security 28 blowfish
 
Information and network security 27 triple des
Information and network security 27 triple desInformation and network security 27 triple des
Information and network security 27 triple des
 

Último

%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 

Último (20)

Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 

Object oriented programming 7 first steps in oop using c++

  • 1. Object Oriented Programming: 7 First Steps in OOP using C++ Prof Neeraj Bhargava Vaibhav Khanna Department of Computer Science School of Engineering and Systems Sciences Maharshi Dayanand Saraswati University Ajmer
  • 2. Benefits of OOP • Through inheritance, we can eliminate redundant code extend the use of existing • Classes. • We can build programs from the standard working modules that communicate with one another, rather than having to start writing the code from scratch. • This leads to saving of development time and higher productivity. • The principle of data hiding helps the programmer to build secure program that can not be invaded by code in other parts of a programs. • It is possible to have multiple instances of an object to co-exist without any interference.
  • 3. Benefits of OOP • It is possible to map object in the problem domain to those in the program. • It is easy to partition the work in a project based on objects. • The data-centered design approach enables us to capture more detail of a model can implemental form. • Object-oriented system can be easily upgraded from small to large system. • Message passing techniques for communication between objects makes to interface descriptions with external systems much simpler. • Software complexity can be easily managed.
  • 4. Application of OOP • Real-time system • Simulation and modeling • Object-oriented data bases • Hypertext, Hypermedia, and expert system • AI and expert systems • Neural networks and parallel programming • Decision support and office automation systems • CIM/CAM/CAD systems
  • 5. Introduction of C++ • C++ is an object-oriented programming language. • It was developed by Bjarne Stroustrup at AT&T Bell Laboratories in Murray Hill, New Jersey, USA, in the early 1980’s. • Stroustrup, an admirer of Simula67 and a strong supporter of C, wanted to combine the best of both the languages and create a more powerful language that could support object-oriented programming features and still retain the power and elegance of C. • The result was C++. Therefore, C++ is an extension of C with a major addition of the class construct feature of Simula67. • Since the class was a major addition to the original C language, Stroustrup initially called the new language ‘C with classes’. • However, later in 1983, the name was changed to C++. The idea of C++ comes from the C increment operator ++, thereby suggesting that C++ is an augmented version of C.
  • 6. Introduction of C++ • The most important facilities that C++ adds on to C are – classes, inheritance, – function overloading and – operator overloading. – These features enable creating of abstract data types, – inherit properties from existing data types and support polymorphism, thereby making C++ a truly object-oriented language.
  • 7. Printing A String in C++ • #include<iostream> • Using namespace std; • int main() • { • cout<< “c++ is a very powerful Object Oriented Programming Language n” ; • return 0; • }
  • 8. Program feature • Like C, the C++ program is a collection of function. • The above example contain only one function main(). As usual execution begins at main(). • Every C++ program must have a main(). • C++ is a free form language. • With a few exception, the compiler ignore carriage return and white spaces. • Like C, the C++ statements terminate with semicolons.
  • 9. Comments • C++ comment symbol // (double slash) is used for single line comments • Comment start with a double slash symbol and terminate at the end of the line. • A comment may start anywhere in the line, and whatever follows till the end of the line is ignored. (Note that there is no closing symbol) • The C comment symbols /*, */ are still valid and are more suitable for multiline comments. The following comment is allowed: • /* This is an example of • C++ program to illustrate • some of its features • */
  • 10. Output operator • cout<< “c++ is a very powerful Object Oriented Programming Language n” ; • Causes the string in quotation marks to be displayed on the screen. • This statement introduces two new C++ features, cout and <<. • The identifier cout (pronounced as C out) is a predefined object that represents the standard output stream in C++. • Here, the standard output stream represents the screen. • The operator << is called the insertion (or put to) operator
  • 11. The iostream File • We have used the following #include directive in the program: • #include <iostream> • The #include directive instructs the compiler to include the contents of the file enclosed within angular brackets into the source file.
  • 12. Namespace • Namespace is a new concept introduced by the ANSI C++ standards committee. • This defines a scope for the identifiers that are used in a program. For using the identifier defined in the namespace scope we must include the using directive, like – Using namespace std; • Here, std is the namespace where ANSI C++ standard class libraries are defined. • All ANSI C++ programs must include this directive. • This will bring all the identifiers defined in std to the current global scope. • Using and namespace are the new keyword of C++.
  • 13. Return Type of main() • In C++, main () returns an integer value to the operating system. • Therefore, every main () in C++ should end with a return (0) statement; otherwise a warning an error might occur. • Since main () returns an integer type for main () is explicitly specified as int. • Note that the default return type for all function in C++ is int.
  • 14. Assignment • Discuss the benefits and applications of object oriented programming • Write a C++ program to print a string “Hello World” on the console output. Briefly Explain the elements of the program.