Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome back to Software Development!

Similar presentations


Presentation on theme: "Welcome back to Software Development!"— Presentation transcript:

1 Welcome back to Software Development!

2 Reading Questions

3 Reading Questions What are scope modifiers (public/private)

4 Reading Questions What are scope modifiers (public/private)
What are properties (Set/Get)?

5 Reading Questions What are scope modifiers (public/private)
What are properties (Set/Get)? What is an instance (static and new)?

6 Reading Questions What are scope modifiers (public/private)
What are properties (Set/Get)? What is an instance (static and new)? What are instance variables?

7 Reading Questions What are scope modifiers (public/private)
What are properties (Set/Get)? What is an instance (static and new)? What are instance variables? What are filters?

8 Reading Questions What are scope modifiers (public/private)
What are properties (Set/Get)? What is an instance (static and new)? What are instance variables? What are filters?

9 Reading Questions What are scope modifiers (public/private)
What are properties (Set/Get)? What is an instance (static and new)? What are instance variables? What are filters?

10 Review – Class Members

11 Review – Class Members Methods

12 Review – Class Members Methods – class algorithms

13 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’

14 Review – Class Members Methods – class algorithms Fields
The actual code that does the work – the ‘algorithm’ Fields

15 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’ Fields – class variables any method of the class can use

16 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’ Fields – class variables any method of the class can use What the book calls “instance variables”

17 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’ Fields – class variables any method of the class can use What the book calls “instance variables” The data or information the class uses to do its job

18 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’ Fields – class variables any method of the class can use What the book calls “instance variables” The data or information the class uses to do its job Properties

19 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’ Fields – class variables any method of the class can use What the book calls “instance variables” The data or information the class uses to do its job Properties – “smart fields”

20 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’ Fields – class variables any method of the class can use What the book calls “instance variables” The data or information the class uses to do its job Properties – “smart fields” Methods that look like fields…you can use them almost like variables

21 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’ Fields – class variables any method of the class can use What the book calls “instance variables” The data or information the class uses to do its job Properties – “smart fields” Methods that look like fields…you can use them almost like variables They “protect” the class variables (fields)

22 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’ Fields – class variables any method of the class can use What the book calls “instance variables” The data or information the class uses to do its job Properties – “smart fields” Methods that look like fields…you can use them almost like variables They “protect” the class variables (fields)

23 Review – Class Members Methods – class algorithms
The actual code that does the work – the ‘algorithm’ Fields – class variables any method of the class can use What the book calls “instance variables” The data or information the class uses to do its job Properties – “smart fields” Methods that look like fields…you can use them almost like variables They “protect” the class variables (fields)

24 Scope Exercise

25 Scope Exercise Follow directions on the sheet

26 Scope Exercise Follow directions on the sheet
You will get a compiler error

27 Scope Exercise Follow directions on the sheet
You will get a compiler error There should only be one!

28 Scope Exercise Follow directions on the sheet
You will get a compiler error There should only be one! It will be about the name ‘b’

29 Scope Exercise Follow directions on the sheet
You will get a compiler error There should only be one! It will be about the name ‘b’ If you get something else, you typed the code in wrong

30 Scope Exercise Follow directions on the sheet
You will get a compiler error There should only be one! It will be about the name ‘b’ If you get something else, you typed the code in wrong You have about 10 minutes…

31 Scope

32 Scope ‘Scope’ means the section of code a variable can be used in

33 Scope ‘Scope’ means the section of code a variable can be used in
Defined by the current block

34 Scope ‘Scope’ means the section of code a variable can be used in
Defined by the current block Blocks are marked by the immediate surrounding curly braces

35 Scope ‘Scope’ means the section of code a variable can be used in
Defined by the current block Blocks are marked by the immediate surrounding curly braces Includes all inner blocks

36 Scope ‘Scope’ means the section of code a variable can be used in
Defined by the current block Blocks are marked by the immediate surrounding curly braces Includes all inner blocks Question:

37 Scope ‘Scope’ means the section of code a variable can be used in
Defined by the current block Blocks are marked by the immediate surrounding curly braces Includes all inner blocks Question: Can one method use a variable declared in another method?

38 Scope ‘Scope’ means the section of code a variable can be used in
Defined by the current block Blocks are marked by the immediate surrounding curly braces Includes all inner blocks Question: Can one method use a variable declared in another method? No

39 Scope ‘Scope’ means the section of code a variable can be used in
Defined by the current block Blocks are marked by the immediate surrounding curly braces Includes all inner blocks Question: Can one method use a variable declared in another method? No If we needed to be able to do this, how could we do it?

40 Scope ‘Scope’ means the section of code a variable can be used in
Defined by the current block Blocks are marked by the immediate surrounding curly braces Includes all inner blocks Question: Can one method use a variable declared in another method? No If we needed to be able to do this, how could we do it? Fields

41 Scope Modifiers

42 Scope Modifiers public / private

43 Scope Modifiers public / private public:

44 Scope Modifiers public / private public: Info anyone can get to

45 Scope Modifiers public / private public: Info anyone can get to
My name…

46 Scope Modifiers public / private public: private:
Info anyone can get to My name… private:

47 Scope Modifiers public / private public: private:
Info anyone can get to My name… private: “PB”… Private Business

48 Scope Modifiers public / private public: private:
Info anyone can get to My name… private: “PB”… Private Business Info only select people can get to

49 Scope Modifiers public / private public: private:
Info anyone can get to My name… private: “PB”… Private Business Info only select people can get to My social security number…

50 Scope Modifiers

51 Scope Modifiers They are now called access modifiers

52 Scope Modifiers They are now called access modifiers
They control who can “access” the fields of a class.

53 Scope Modifiers They are now called access modifiers
They control who can “access” the fields of a class. public:

54 Scope Modifiers They are now called access modifiers
They control who can “access” the fields of a class. public: Any code with access to the class can read or change a public field!

55 Scope Modifiers They are now called access modifiers
They control who can “access” the fields of a class. public: Any code with access to the class can read or change a public field! Very dangerous - rarely use this.

56 Scope Modifiers They are now called access modifiers
They control who can “access” the fields of a class. public: Any code with access to the class can read or change a public field! Very dangerous - rarely use this. private:

57 Scope Modifiers They are now called access modifiers
They control who can “access” the fields of a class. public: Any code with access to the class can read or change a public field! Very dangerous - rarely use this. private: Only members of the same class can read or change a private field. Example…

58 Scope Modifiers They are now called access modifiers
They control who can “access” the fields of a class. public: Any code with access to the class can read or change a public field! Very dangerous - rarely use this. private: Only members of the same class can read or change a private field. If we shouldn’t use public, how to we safely let other code access our fields?

59 Scope Modifiers They are now called access modifiers
They control who can “access” the fields of a class. public: Any code with access to the class can read or change a public field! Very dangerous - rarely use this. private: Only members of the same class can read or change a private field. If we shouldn’t use public, how to we safely let other code access our fields? Properties

60 Scope Modifiers They are now called access modifiers
They control who can “access” the fields of a class. public: Any code with access to the class can read or change a public field! Very dangerous - rarely use this. private: Only members of the same class can read or change a private field. If we shouldn’t use public, how to we safely let other code access our fields? Properties – “smart fields” that control reading (Get) and changing (Set)


Download ppt "Welcome back to Software Development!"

Similar presentations


Ads by Google