Skip to main content

1. c++ concepts

  c++ Oops concepts :-


           The major purpose of C++ programming is to introduce the concept of object orientation to the C programming language.
           Object Oriented Programming is a paradigm that provides many concepts such as inheritance, data binding, polymorphism etc.
           The programming paradigm where everything is represented as an object is known as truly object-oriented programming language. Smalltalk is considered as the first truly objectoriented programming language.


 Oops introduction :-

          Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts:

• Object
• Class
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation


Object :-

         Any entity that has state and behavior is known as an object. For example: chair, pen, table, keyboard, bike etc. It can be physical and logical.

Class :-

        Collection of objects is called class. It is a logical entity. 

Inheritance :-

        When one object acquires all the properties and behaviours of parent object i.e. known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.

Polymorphism :-
  
        When one task is performed by different ways i.e. known as polymorphism. For example: to convince the customer differently, to draw something e.g. shape or rectangle etc.
In C++, we use Function overloading and Function overriding to achieve polymorphism.

Abstraction :-

        Hiding internal details and showing functionality is known as abstraction. For example: phone call, we don't know the internal processing.
In C++, we use abstract class and interface to achieve abstraction.

● Encapsulation :-

       Binding (or wrapping) code and data together into a single unit is known as 
encapsulation. For example: capsule, it is wrapped with different medicines.


Comments

Popular posts from this blog

C++ programming language

                c++ is a general programming language and is widely used nowadays for competitive programming. It has imperative, object-oriented and generic programming features.C++ runs on lots of platforms like Windows, Linux, Unix, Mac etc.   ❖❖  C++ with oops ❖❖

7. Switch Statement in c++

 ❖ C++ switch Statement :-                Consider a situation in which, only one block of code needs to be executed among many blocks. This type of situation can be handled using nested if...else statement but, the better way of handling this type of problem is using switch...case statement.  Syntax of switch:-      Switch(expression) {            Case value1 : statement1;                       Break;             Case value2 : statement2;                      Break;             Default : default statements;  }               The expression is either an integer or a character in above syntax. If the expression matches constant in case, the relevant codes a...

3. Input /output in c++

  ➢   Input/ Output in C++ :-        C++ comes with libraries which provides us many ways for performing input and output. In C++.        input and output is performed in the form of sequence of bytes or more commonly known as  streams. ● Input Stream: If the direction of flow of bytes is from device(for example: Keyboard) to the main memory then this process is called input. ● Output Stream: If the direction of flow of bytes is opposite, i.e. from main memory to device(display screen ) then this process is called output. ● Header files available in C++ for Input – Output operation are: • iostream: iostream stands for standard input output stream. This header file contains definitions to objects like cin, cout, cerr etc. • fstream: This header file mainly describes the file stream. This header file is used to handle the data being read from a file as input or data being written into the file as output.       ...