Posts

Showing posts from January, 2017

Include Vs Import

Image
There are two terms IMPORT and INCLUDE ,  In C and C++ Programs ,  Include Statement is used #include directive makes the compiler go to the C/C++ standard library  It copy the code from the header files into the program.  The whole include file code will copy into the program  As a result, the program size increases wasting memory and processor’s time.  In Java Programs , Import  Statement is used import statement makes the JVM(Java Virtual Machine) go to the Java standard library, execute the code there ,  and substitute the result into the program.  Hence, no code is copied hence no waste of memory and processor’s time. Hence import is more efficient mechanism than #include. By - Somesh Sah

Function Overloading

Image
  Function Overloading -  " Multiple Definition of a function with in same scope having different signature are called Function Overloading   " Signature of a function- Number & Type of a parameter of a function is called signature of the function. Question - Write an overloaded function area which will print the area of circle,rectangle and square. Program - #include<iostream> using namespace std; //function prototype  int area(int); int area (int,int); double area (double); int main(){ cout<<"Calling area with 5cm side : "<<area(5)<<endl; cout<<"calling area with l=5,b=10 : "<<area(5,10)<<endl;   cout<<"calling area with 5.5cm radius : "<<area(5.5); return 0; }  //Area of square  int area (int side){ return (side*side); } //area of rectangle int area(int length ,int breadth){ return (length * breadth); }  //area of cir...

Object Oriented Program (Paradigm)

Image
Paradigm - It is a mythology and implementation of the program. (It is a way of programming) Therefore, There are three ways (Style) to write a program - ♣ Procedural Programming  ♣ Object Based Programming ♣ Object Oriented Programming  Procedural Programming -  ☻ Importance is given to the procedural (Function and Methods) ☻ Data is secondary ( data moves openly) ☻ It follows Top-Down Designing. Example - Basic and C  Object Based Programming - ☻ These languages support Classes  ☻ These languages does not support Inheritance and Polymorphism    Example - ada Object Oriented Programming - ☻ These language support all the mentioned features Encapsulation Abstraction Polymorphism Inheritance ☻ Data is hidden ☻ It follows bottom up design  Example - C++ , Java etc. Now, Object Oriented Programming (OOP's) in detail  DEFINITION OF OOPs " O...