0% found this document useful (0 votes)
15 views6 pages

Introduction To C++

C++ is an object-oriented programming language developed by Bjarne Stroustrup in the 1980s, combining features from Simula67 and C. Key differences between C and C++ include the introduction of keywords specific to C++, the requirement for the main function to return an int, and the flexibility in declaration placement within the code. C++ also supports inline functions, default function arguments, and additional comment styles.

Uploaded by

Pratit Raj Giri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views6 pages

Introduction To C++

C++ is an object-oriented programming language developed by Bjarne Stroustrup in the 1980s, combining features from Simula67 and C. Key differences between C and C++ include the introduction of keywords specific to C++, the requirement for the main function to return an int, and the flexibility in declaration placement within the code. C++ also supports inline functions, default function arguments, and additional comment styles.

Uploaded by

Pratit Raj Giri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Introduction to C++

Introduction
• OOP developed by Bjarne
Stroustrup at AT&T Bell laboratories
in 1980s
• Combination of Simula67 and C
• Classes, inheritance, function
overloading, and operator overloading
are the most important features in C++
Differences between C and C++ (1)
• Keywords
asm catch class new operator
private protected public using namespace
• Length of identifiers
– No limit in C++
• Declarations
– In C global variables can be declared several times without
using extern specifier. But in C++, it must be declared
once without extern and all the remaining must use the
extern specifier
• Global const
– In C, a global const has an external linkage. But in C++, all
const values are static by default and thus become local
Differences between C and C++ (2)
• Main function
– In C++ main() function must return a value of type int
• Functions with no arguments
– Example: int myFunction()
This means unspecified number of arguments in C and
exactly zero arguments in C++
• Inline functions
inline int add(int a, int b)
{
return (a+b);
}
• Default function arguments
Void myFunction(int a, int b=5, int c=10);
Differences between C and C++ (3)
• Declarations
– In C, all declarations should be made at the
top. But in C++, declarations can be made at
any point of the program
• Scope Resolution
– An operator :: known as scope resolution
operator is used in C++ to access an item
outside the current scope.
Differences between C and C++ (4)
• Comments
–C++ supports // comment style
in addition to /*…….*/
comment style
–Useful for one line comment

You might also like