Solu�ons Manual for Advanced Visual Basic
2010, 5
th Edi�on By Kip Irvine, Tony Gaddis (All Chapters, 100% Original Verified, A+ Grade) Visual Basic Program Files Download Link at The End of This File. 1 / 3
Page 1 Answers to Review Questions Advanced Visual Basic 2010, 5 th Edition, by Kip Irvine and Tony Gaddis Copyright © 2012, 2007 Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. If you have questions or corrections relating to this document, please
send them to: [email protected].
Last update: March 4, 2011
Chapter 1: Classes
True or False
- False
- False
- False
- False
- False
- False
2.True
6.True
9.True 10.True 11.False Short Answer
1.No, you can write: If isFullTime Then . . .
- Presentation tier
- Middle (business logic) tier
3.As class methods
5.At runtime, when multiple instances of the class exist, no more than a single copy of a shared variable exists. In contrast, each instance of the class will contain its own copy of a non-shared va riable.
6.Shared property:
class Window Public Shared Property Color as String
7. Declaring the MyMethod method:
Sub MyMethod(ByRef str As String)
- Information hiding (encapsulation)
9.Create public properties that ge t and set the variable's value. 2 / 3
Page 2
10. Constructor with optional parameters:
Class Hero Public Sub New(Optional ByVal pStrength As Integer = 0, Optional ByVal pIntelligence As Integer = 0) Strength = pStrength Intelligence = pIntelligence End Sub
- The Set section is omitted.
- The Clone method.
- Right-click the project name in the Solution Explorer window, select Add, and select Class.
14. Variable declaration:
Private Shared smDefaultColor As String
- Parameterized constructor
16. Opening a text file for input:
Dim reader As StreamReader = OpenText("myfile.dat")
- Read from StreamReader
- EndOfStream property
- You must use a subscript when inserting the items in the target array. But you can use a For
Dim line As String = reader.ReadLine()
What Do You Think?
Each loop to access the source array:
Dim index As Integer = 0 Dim target(Names.Length-1) As String For Each nam As String in Source target(j) = nam j += 1 Next
- Because the Clone method returns an array of type Object, which cannot be directly
- When the different instances of the class need to access a shared value. The default
- Because the middle tier might be accessed by Web applications, Windows forms
- Because the parameter names hide the class-level variables, a technique called masking.
- Because it might not be appropriate to create an instance of the class without assigning it
- It stores a message string in the LastError property and returns a value of False. It might be
- Property
- / 3
assigned to a specific array type.
background color for windows is a good example.
applications, or other specialized application types.
custom values (such as ID number).
better to throw an exception, which forces the calling method to acknowledge the error.Algorithm Workbench