An Introduction To C++
C++ is an extension to C programming Language. It is developed by Bjarne Stroustrup in 1980 at AT & T Bell Laboratories. C++ is created as a bridge between Object Oriented Programming Language and C. C++ is an object oriented programming language. C++ fully support Object Oriented Programming language with 4 main concept encapsulation, data hiding, inheritance, and polymorphism. C++ is also called a high level language. C++ programs are reusable and extensible; existing code is easily modifiable without actually having to change the code. C++ also called superset of C. C programs can be run on C++ Compiler. C language uses structure programming language while C++ uses the concept of object oriented programming language. C++ mainly focuses on Classes and Objects.
History Of C++
C++ was designed for the UNIX system
environment. With C++ programmers could improve the quality of code. Before C++,
C was a programming language developed at Bell Labs. There are several versions of the C++
language, of which Visual C++ is only one. Other include Borland C++,
Turbo C++ etc.
C++ supports multiple programming styles. C++ provides more than 30 operators, almost all the operators can be overloaded. C++ gives object oriented features to C. C++ has many new keywords, such as
class, that may be used in a C program as identifier.
Advantages And Disadvantages Of C++
ADVANTAGES: C++ have advance features than C.
C++ have the oops concepts that are not in C.
C++ have the concept of classes and objects.
C++ have scope resolution operator (::) that is used to access an item hidden in the current scope.
C++ uses reference variables.
C++ have the concept of namespaces that reduces collision problem.
C++ have the concept of operator overloading.
C++ is high level language. We can add new functions or behaviour easily. Each entity can easily be modified, easily reuse and upgrade.
it's not pure object oriented programming language, because it doesn't support for garbage collection .
C++ does not provide very strong type-checking.
C++ is poor in Multitasking.
Scope is also limited of C++.
Scope Of C++
Kinds of scope in C++:
A name can have local scope if it is declared in a block. A name with local scope can be used in that block. But the name must be declared before it is used.
The name of a class member has class scope and can only be used in the following cases
- In a member function of that class
- In a member function of a class derived from that class
- After the . (dot) operator applied to an instance of that class
- After the :: (scope resolution) operator applied to the name of a class