Posts

Showing posts from February, 2022

What is Overloading and Overriding

Overloading occurs when two or more methods in one class have the same method name but different parameters. Overriding occurs when two methods have the same method name and parameters. One of the methods is in the parent class, and the other is in the child class. Overriding allows a child class to provide the specific implementation of a method that is already present in its parent class. https://www.educative.io/edpresso/overloading-vs-overriding

Difference Between Procedural and Non-procedural Language

  Procedural language The program code is written in the form of a sequence of instructions. The user would specify what has to be done and how it can be done, i.e the step by step procedure of it. It is considered as a command-driven language. It works with the state of the machine. Its semantics are tough in comparison to other paradigms. The size of the program would be large. These steps would be executed in a sequential method. It returns restricted data types and certain allowed values only. The overall efficiency is high. The instructions are written to solve a specific/set of problems. Examples of procedural languages include BASIC, FORTRAN, ALGOL, C, COBOL, and Pascal. It is not suited for applications where time is a critical constraint. The iterative loops and recursive calls are used while working in procedural languages. Non-procedural Language The user would specify what has to be done but doesn't get into the how it has to be done part. It is known as an applicative ...

Star pattern 4

Image
  # include < iostream > using namespace std ; int space ; int row = 5 ; int main (){     for ( int i = 1 ; i <= 5 ; i ++ ){         for ( space = 1 ; space <= ( row - i ); space ++ )         {             cout << " " ;         }         for ( int j = 1 ; j <= i ; j ++ )         {             cout << " * " ; // add some space just after star         }         cout << " \n " ;     }     return 0 ;     }