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 December 9th, 2004, 03:00 AM
Registered User
 
Join Date: Dec 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Newbie question on the 2nd ed: Class inheritance

The example on page 1162 (Appendix A, Adding Inheritance section), shows that the field "private decimal balance" from the base class "Customer" is changed to "protected decimal balance". On page 1163 it is stated that the reason is that so the derived class "Nevermore60Customer" can access "balance" field. My question is, why the "name" field on the base class is not changed to protected also? Because the derived class needs to access it to, right?

Is "protected" only used in inheritance? Because in instantiating, the instance class also needs to access the fields from the base class. Should the fields in the base class need to be changed to protected also?

Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about Class Inheritance forkhead Pro VB.NET 2002/2003 0 March 21st, 2005 03:37 PM
No download for Beginning XML 2nd Ed anywhere kdalbey Forum and Wrox.com Feedback 2 December 13th, 2004 10:45 AM
Prob.s with ch.16 of Profes. JSP 2nd Ed. bobbob Pro JSP 1 April 5th, 2004 06:29 AM
Prob.s running Profes. JSP 2nd Ed. ch16 examp.s bobbob JSP Basics 0 February 6th, 2004 09:50 PM
Cannot find code to vb.net 2nd ed..help? lizardnotebk BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 0 September 2nd, 2003 07:17 PM





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