WHAT IS OOP?

Object-oriented programming or OOP is a  methodology or a paradigm to design a program using classes and objects utilising features of OOPs such as abstraction, encapsulation, inheritance and polymorphism.

Benefits of OOP:-

1. It is easy to model a real system as real obects are represented by programming objects in OOP.

2. With the help of inheritance, the existing class can be reused to derive a new class such that the redundant code is eliminated and the use of existing class is extended. This saves time and cost of program.

3. In OOP, data can be made private to a class such that only member functions of the class can access the data. Hence, a secure program is built.

4. With the help of polymorphism, the same function or same operator can be used for different purposes.

5. Large problems can be reduced to smaller and more manageable problems.

6. It is possible to have multiple instances of an object to co-exist without any interference i.e. each object has its own separate member data and function.

OOP v/s POP:-


1. OOP, stands for Object-oriented programming, is a programming approach that focuses on data rather than the algorithm. 
                      Whereas POP, short for Procedural-oriented programming, focuses on procedural abstraction.
2. In OOP, the program is divided into small chunks called objects (instances of classes), whereas in POP, the main program is divided into small parts based on the functions.

3. Accessing modes (‘Private’, ‘Public’ and ‘Protected’) are used in OOP to access attributes or functions, whereas there is no such modes required in POP.

4. In OOP, various function can work simultaneously while POP follows a systematic step-by-step approach to execute method and functions.

5. OOP is more secure than POP as OOP supports the data hiding function which is absent in POP.
6. OOP follows a bottom-up approach to design a program while POP follows a top-down approach.
7. Commonly used OOP languages are C++, Java, etc. Pascal and Fortran are used by POP.

Writing programs is the best way to learn a programming language. Now, let's see the basic structure of a C++ program:

Syntax:

#include<iostream.h>
int main()
{
    ...;
    return 0;
}

Example:
#include<iostream.h>
//main() is where program execution begins.
int main()
{
    cout << "This is my first C++ Program with coding smash!";
    return 0;
}

OUTPUT:


This is my first C++ Program with coding smash!

Let's examine this program line by line:

1. The C++ language defines several headers, which contain information that is either necessary or useful to your program. For this program, #include<iostream.h> header is needed. this header file is included for Standard I/O (input output) function.

2. A blank line : It has no effect on a program and simply improve readability of the code.

3. The next line //main() is where program execution begins. is a single-line comment available in C++. Single-line comments begin with // and stop at the end of the line. Slash sign(//) has no effect on the behaviour of the program.

4. The line int main() is the main function where program execution begins.

5. The next line cout << "This is my first C++ program!"; causes the message "This is my first C++ program" to be displayed on the screen.

6. The next line return 0; terminates main() function and causes it to return the value 0 to the calling process.

Uses of C++ 

1. It is used for the development of many applications like Illustrator, adobe premier, etc.
2. C++ is used for developing different games because it is very fast.
3. It is widely used in building real-time, image processing, mobile sensor applications, and visual effects, modeling which is mainlu coded in C++.
4. This language is used for developing browsers such as Google Chrome, and Mozilla Internet browser Firefox.
5. C++ is also used for developing database software for example MySQL, which is one of the most popular database management software and widely used in organizations. 
6. C++ is used for creating media players, managing video and audio files. One such example is Winamp Media player. It also provides access to Internet radio stations.
7. Most of the compilers are mainly written in C++ language.
8. It is also used to develop most of the operating systems for Microsoft and few parts of the Apple OS.
9. C++ is also used for medical and engineering applications.

Hence, C++ is the language which is used everywhere but mainly in systems programming and      embedded systems. It is the safest language with simple syntax and errors can be easily replicated.