0% found this document useful (0 votes)
28 views10 pages

Intro To Programming 10th Lecture

Methods require an object to run while functions can run independently. Static methods and variables are shared among all objects while non-static ones are unique to each object. Static variables are stored in stack memory and non-static in heap memory.

Uploaded by

Abhishek Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views10 pages

Intro To Programming 10th Lecture

Methods require an object to run while functions can run independently. Static methods and variables are shared among all objects while non-static ones are unique to each object. Static variables are stored in stack memory and non-static in heap memory.

Uploaded by

Abhishek Singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

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

You might also like