Wrox Programmer Forums
|
BOOK: Beginning Visual C# 2010
This is the forum to discuss the Wrox book Beginning Visual C# 2010 by Karli Watson, Christian Nagel, Jacob Hammer Pedersen, Jon D. Reid, Morgan Skinner, ; ISBN: 9780470502266
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual C# 2010 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 27th, 2012, 08:50 AM
Registered User
 
Join Date: Dec 2009
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Default How to understand this sentence?

How It Works
The code in Main() creates and uses an instance of the MyClass class defined in MyClass.cs. Instantiating this class must be performed using a nondefault constructor because the default constructor of MyClass is private:
private MyClass() : this("Default Name")
{
}


Using this("Default Name") ensures that Name gets a value if this constructor is ever called, which is possible if this class is used to derive a new class. This is necessary because not assigning a value to the Name field could be a source of errors later.

I don't understand, how to call a private constructor if deriving a new class?





Similar Threads
Thread Thread Starter Forum Replies Last Post
I need to search for a word in a sentence. pmedlin Access VBA 4 August 11th, 2010 04:06 PM
Copy whole sentence that contains "Alarm" mona_upm84 Excel VBA 3 September 10th, 2008 01:03 PM
search a text and return the sentence sankar2chat SQL Server 2000 9 July 17th, 2008 02:27 PM
a bold word in a selected sentence Birger XSLT 4 January 1st, 2007 07:02 PM
Pick a sentence out of a memo field stryker43 Crystal Reports 1 October 14th, 2004 05:23 PM





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