Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > BOOK: Professional C#, 2nd and 3rd Editions
|
BOOK: Professional C#, 2nd and 3rd Editions
This is the forum to discuss the Wrox book Professional C#, 3rd Edition by Simon Robinson, Christian Nagel, Karli Watson, Jay Glynn, Morgan Skinner, Bill Evjen; ISBN: 9780764557590
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional C#, 2nd and 3rd Editions 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 March 19th, 2005, 01:05 AM
Registered User
 
Join Date: Feb 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yuanlairuci
Default A problem about the use of the private member

  In the Chapter 5 of the 2nd Edition i find a problem about the example of MortimerPhonesEmployees.As follows:
    class EmployeeID
   {
      private readonly char prefix;
       private readonly int number;

      ..........
      ..........
      public override bool Equals(object obj)
      {
         EmployeeID rhs = obj as EmployeeID;
         if (rhs == null)
            return false;
         if (prefix == rhs.prefix && number == rhs.number)
            return true;
         return false;
      }
   }
  prefix and number are the private members of the object rhs,why it can be used like the bold?Thanks for the helper!


yuanlairuci
 
Old April 7th, 2005, 02:24 AM
Registered User
 
Join Date: Apr 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

3rd.Edition Page 100
Note that the field is also public¡ªwe don¡¯t normally need
to make readonly fields private, because by definition they cannot be modified externally (the same principle also applies to constants).






Similar Threads
Thread Thread Starter Forum Replies Last Post
New Member Install TBH problem smhaig BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 February 10th, 2007 01:33 PM
private constructor in C# n.nsivakumar C# 1 August 16th, 2006 07:08 AM
A problem about the use of the private member yuanlairuci C# 2 March 23rd, 2005 09:42 PM
Using Private Sub cutovoi Excel VBA 0 February 5th, 2004 12:55 PM





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