chap06 - Chapter 6 Writing a Problem Domain Class...

Info iconThis preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Object-Oriented Application Development Using VB .NET 1 Chapter 6 Writing a Problem Domain Class Definition
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object-Oriented Application Development Using VB .NET 2 Objectives In this chapter, you will: Learn VB .NET naming conventions Develop a problem domain (PD) class definition Define attributes Write methods and properties Test a PD class
Background image of page 2
Object-Oriented Application Development Using VB .NET 3 Objectives In this chapter, you will: Create an instance Write a constructor method Write a TellAboutSelf method Write a Tester class as a Form
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object-Oriented Application Development Using VB .NET 4 VB .NET Naming Conventions Class names Start with a capital letter Examples: Customer, Boat Attribute names Begin with a lowercase character Subsequent words are capitalized Examples: address, phoneNo Method names Begin with an uppercase character Subsequent words are capitalized Examples: GetPhoneNo, SetAddress, ComputeLease
Background image of page 4
Object-Oriented Application Development Using VB .NET 5 Developing a PD Class Definition Bradshaw Marina system PD classes include Customer Boat Slip Dock Class definition Code that represents a class Contains attributes and methods of the object
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object-Oriented Application Development Using VB .NET 6 Developing a PD Class Definition Customer class Represents marina’s customers Has attributes for customer’s Name Address Telephone number
Background image of page 6
Object-Oriented Application Development Using VB .NET 7 Developing a PD Class Definition
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object-Oriented Application Development Using VB .NET 8 Class Definition Structure Structure of a class definition Class header Attribute definitions Method code Class header Line of code that identifies the class and some of its characteristics
Background image of page 8
Object-Oriented Application Development Using VB .NET 9 Class Definition Structure Class header for the Customer definition: Public Class Customer Keyword Public indicates that the class has public accessibility Keyword Class indicates that this line of code is a class header Customer establishes the class name
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Object-Oriented Application Development Using VB .NET 10 Defining Attributes Attributes: defined by declaring variables for each attribute An attribute definition Written in the same way as a variable is declared, except: Keyword Private is used instead of Dim Customer attributes are defined as follows: 'attributes Private name As String Private address As String Private phoneNo As String
Background image of page 10
Object-Oriented Application Development Using VB .NET 11 Defining Attributes When defining attributes, a variable’s accessibility can be: Public: allows any class to access the variable directly Private: prohibits direct access; variable is accessible only within the class where it is defined Protected: allows subclasses to have direct access Friend: permits classes within the same assembly to
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/07/2008 for the course CSC 208 taught by Professor Walker during the Spring '06 term at Monroe CC.

Page1 / 40

chap06 - Chapter 6 Writing a Problem Domain Class...

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online