Method
- dependent upon the object (It will run with the help
of objects only)
- Method will require object's name as well to call it
Function
- independent in nature (It will run independently)
- Function can be called directly with it's name
static function/method - they will never require object
non-static function/method - they will always require object
static variables - are used when all objects share this
variable (if one object makes changes into it then change is
reflected in another object as well
non-static variable - they will different for different objects
static variables are stored inside stack memory
non-static variables are stored inside heap memory
temp = a;
a = b;
b = temp;
Prime numbers are
only divisible by 1
and itself and no
other number can
divide it
Object Oriented Programming
- Inheritance
- Abstraction
- Polymorphism
- Encapsulation
Coding Test, Interview
- You will be told whether to make a static/
non - static function
Company
- You will follow Design Patterns
- Singleton Design Pattern
- Factory Design Pattern
Using Design pattern you will decide which
function is static or non-static