Object Oriented Programming : Part 1

708 views

Published on

OOPs : Object Oriented programming pre-requisites.
A tutorial on OOPs by an average student.

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
708
On SlideShare
0
From Embeds
0
Number of Embeds
262
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Object Oriented Programming : Part 1

  1. 1.     OOPs Placement Class 2013 23 September
  2. 2.     Pre­requisites ● OS Stack ● Variables  ● Functions
  3. 3.     The Stack ● Call­Stack,  Execution­Stack,  Runtime­Stack,  Machine­Stack ●
  4. 4.     Variables ● A variable is an IDENTIFIER for a VALUE
  5. 5.     Variables ● A variable is an IDENTIFIER for a VALUE ● IDENTIFIERS = (KEY WORDS) U (QUALIFIED IDENTIFIERS) ● QUALIFIED ID = (Var Names) U (Class names) U (Function names) U ...
  6. 6.     Variables ● Question : ● What is the difference between the following : ● #define myVar 10 ● int myVar = 10;
  7. 7.     Variables QUESTION: How will this program behave? Output?
  8. 8.     Variables
  9. 9.     Variables Mapping VAR­>Address VALUE
  10. 10.     Variables Mapping VAR­>Address VALUE ● Why not directly VAR­>VALUE mapping? ● Different data types have different memory reqt ● int coolness = 5; Datatype        VariableName          Value
  11. 11.     Variables Memory Reqt ● INT : 4B ● FLOAT : 4B ● DOUBLE : 8B ● LONG LONG INT : 10B ● POINTER (int *coolness) = 32b / 64b???
  12. 12.     Variables Memory Reqt ● INT : 4B ● FLOAT : 4B ● DOUBLE : 8B ● LONG LONG INT : 10B ● POINTER (int *coolness) = 32b / 64b
  13. 13.     END OF VARIABLES
  14. 14.     Functions ● Function has the following : ● Return Type ● Parameters ● Function Name (Qualified Identifier) ● Body
  15. 15.     Functions ● Function has the following in a Programming language : ● Return Type ● Parameters ● Function Name (Qualified Identifier) ● Body
  16. 16.     Functions ● Function can be called (evoked) in 2 ways: ● Call by REFERENCE ● Call by VALUE
  17. 17.     Functions – Call by reference ● Pass the address of where the value is stored in memory
  18. 18.     Functions – Call by reference OUTPUT?
  19. 19.     Functions – Call by reference
  20. 20.     Functions – Call by Value ● Makes a COPY of the parameters passed  and uses the COPY in the function body
  21. 21.     Functions – Call by Value ● Makes a COPY of the parameters passed  and uses the COPY in the function body ● This is a form of scoping too
  22. 22.     Functions – Call by Value OUTPUT?
  23. 23.     Functions – Call by Value
  24. 24.     Functions – Call by Value
  25. 25.     Functions – Call by Value Trivia + Trick Question!
  26. 26.     Functions – Call by Value
  27. 27.     Functions – TRIVIA 15 years back, before C++ came in, Address(cool) = Address(coolness) WHY?
  28. 28.     Functions – TRIVIA 15 years back, before C++ came in, Address(cool) = Address(coolness) COMPILER OPTIMIZATION!
  29. 29.     Next : OOPs

×