Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 2nd, 2005, 04:32 AM
Authorized User
 
Join Date: Sep 2004
Posts: 57
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Brettvan1
Default Fancy a challenge that would really help me out?

Hi all...
Could anyone help me with this code please ?
I need to create a base class "shopkeeper" with the following fields...

Constructor
Takes first name and last name as arguments

Properties
First name and last name

Method
To String (this overrides the base class method and returns the full name of the shopkeeper in the form

Abstract read only property
Monthly pay

This is what I have so far''''

Public Class Employee
Private strFirstName As String
Private strLastName As String

Public Sub New(ByVal FirstName As String, ByVal LastName As String)




End Sub
End Class

I know, not a lot, If you could just help me get this first bit I'm sure the rest of what I have to code will fall into place. Please, any help or pointers would be much appreciated.

Thanks for your time.

Thanks


 
Old June 2nd, 2005, 07:49 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Try this for an explaination of properties:
http://msdn.microsoft.com/library/de...esoverview.asp



-Peter
 
Old June 2nd, 2005, 09:42 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Your New must take the arguments passed in, and put their values into strFirstName and strLastName.

When you create a property, .NET will create a format for you with a Get and a Set. The set will take 1-or-more arguments, and will adjust the values of internal variables with that info (eg, strFirstName, strLastName, etc.).
The Get will have a return value. When using the class, the computer will recognize whether you are setting or retrieving a value through the usage you are presenting, and will choose the proper half of the property to use (Get or Set).

With what you are providing, monthly pay is impossible.
But if you had a read-only property (which then would only have a Get), which returned a constant (which therefore would be the same for all instances of the class), that could serve as a mockup of a read-only monthly pay.





Similar Threads
Thread Thread Starter Forum Replies Last Post
A little challenge... chacquard Access VBA 7 February 2nd, 2007 11:38 AM
query challenge alexxx Access 5 October 31st, 2006 03:34 PM
Memobox Challenge rocknrisk Access 8 July 30th, 2005 02:36 AM
A Challenge... AForgue XSLT 3 November 5th, 2003 04:14 PM
Challenge.... developerz BOOK: ASP.NET Website Programming Problem-Design-Solution 2 September 29th, 2003 04:49 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.