Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 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 October 6th, 2006, 10:58 AM
Authorized User
 
Join Date: Mar 2006
Posts: 14
Thanks: 0
Thanked 1 Time in 1 Post
Default 'this.ID = id;' in class construction

Hi,

I have a question on the 'ArticleDetails' Class on page 219.

Previously I have created class properties by doing the following:

- pass a parameter into the class constructor as follows:
public ArticleDetails(int ID)
- declare a private field within the class:
private int _id = 0;
- declare a public property withint the class:
public int ID
{
    get { return _id; }
    set { _id = value; }
}


However, on page 219, the parameter passed into the class is:
id, as in public ArticleDetails(int id)
rather than:
ID, as in public ArticleDetails(int ID)
And there is the additional statement:
this.ID = id;

What is the purpose of doing it this way? Is it just a difference of syntax which achieves exactly the same thing, or is there something else going on here?
Is 'this.ID' available due to the public property declaration later on in the code, i.e. 'public int ID'?

Basically, the way I have known to do this involves two variables,
_id and ID
The example on page 219 involves three variables:
_id, ID and id

Why is this?

Any thoughts on this would be much appreciated.

Thanks! :)

Holf






Similar Threads
Thread Thread Starter Forum Replies Last Post
The class is configured to run as a security ID di marko2748au Pro VB Databases 2 January 20th, 2011 11:42 PM
Class to set student name & id curiaquita Visual C++ 2 February 3rd, 2009 01:54 PM
XSLT change class attribute by ID? matallen XSLT 8 March 1st, 2006 05:00 PM
ID crmpicco HTML Code Clinic 5 February 10th, 2005 11:50 AM
why not index.asp?id=1 can be www.myweb.com/?id=1 BurhanKhan Classic ASP Professional 11 September 6th, 2004 02:06 PM





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