Wrox Programmer Forums
|
BOOK: MCSD Certification Toolkit (Exam 70-483): Programming in C#
This is the forum to discuss the Wrox book MCSD Certification Toolkit (Exam 70-483): Programming in C# by Tiberiu Covaci, Rod Stephens, Vincent Varallo, Gerry O'Brien; ISBN: 978-1-118-61209-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: MCSD Certification Toolkit (Exam 70-483): Programming in C# 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 July 3rd, 2013, 03:27 AM
Registered User
 
Join Date: Mar 2013
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch 3 Pg 101 Indexed Properties

Code:
 
namespace IPAddress
{
    public class IPAddress
    {
        private int[] ip; shouldn't it be instantiated? 
                                      for example: private int[] ip = new int[32]; (?)                                                                                                         
        
        public int this[int index]
        {
            get { return ip[index]; }
            set 
            { 
                if (value == 0 || value == 1)
                ip[index] = value;

                else
                    throw new Exception("Invalid value");
            }

         }
    }

    class Program
    {
        static void Main(string[] args)
        {
            IPAddress myIP = new IPAddress();

            // initialize the IP address to all zeros
            for (int i = 0; i < 32; i++)
            {
                myIP[i] = 0
             }
        }
   }
 
Old July 3rd, 2013, 11:56 AM
Registered User
 
Join Date: Jun 2013
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
Post Arrays

Marsal,

I think either way will create an array of 32 items.

declaration like this : int[] ip = new int[5]; that give you a array [0,1,2,3,4] each one with a zero value.

if you use this; private int[] ip = new int[32]; the array will have 32 items all initialized to zero and you would not need the Main logic.

but this logic will also initialize to 32 items:
for (int i = 0; i < 32; i++)
{
myIP[i] = 0
}
 
Old July 4th, 2013, 01:18 AM
Registered User
 
Join Date: Mar 2013
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for replying cocis48, but I ran it and got an null error on ip. But when I changed it to
Code:
private int[] ip = new int[32];
it ran. I printed it to console to confirm. I am just learning...
 
Old July 7th, 2013, 02:00 PM
Registered User
 
Join Date: Jun 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

On page 111 there is grammar error under Indexed Properties section.
This is how it is written: "Must be access using an index..."
Should be: "Must be accessed using an index..."
 
Old August 18th, 2013, 07:10 AM
Registered User
 
Join Date: Jun 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Class diagram on page 172

On Figure 5-3 in my understanding "Customer" class should be actually "Student" class.
 
Old August 18th, 2013, 09:33 AM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

You're right. Sorry about that.

Thanks for pointing this out!
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 
Old August 22nd, 2013, 02:26 PM
Registered User
 
Join Date: Aug 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think that next clause is partly wrong "If multiple optional parameters exist and a value is specified for one, all preceding optional parameters must also be supplied values."
No need to supply value for preceding optional parameters. We can use named parameter.

Named and Optional Arguments (MSDN)

Example:
Code:
 
        // The first parameter, required, has no default value assigned 
        // to it. Therefore, it is not optional. Both optionalstr and  
        // optionalint have default values assigned to them. They are optional. 
        public void ExampleMethod(int required, string optionalstr = "default string",
            int optionalint = 10)
Code:
            // You can use a named parameter to make the previous  
            // statement work.
            anExample.ExampleMethod(3, optionalint: 4);
 
Old August 22nd, 2013, 04:07 PM
Authorized User
 
Join Date: Jun 2013
Posts: 36
Thanks: 1
Thanked 4 Times in 4 Posts
Default

We can use named parameters, but if we are not using them - and in this case we are not - we have to supply all preceding optional parameters and the phrase is absolutely correct.
 
Old September 8th, 2013, 11:55 AM
Registered User
 
Join Date: Jun 2013
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Page 209 typo

On page 209 it says "This type represents methods that take a float as a parameter and returns an integer", where as on page 208 the type is defined as follows:

private delegate float FunctionDelegate(float x);
 
Old September 8th, 2013, 12:01 PM
Rod Stephens's Avatar
Wrox Author
 
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Sorry about that. The declaration on page 208 should have been:
private delegate int FunctionDelegate(float x);
This is listed on the book's errata page.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Contact Form Too Restrictive - Many "Invalid Characters" Errors 4oh4 Beginning PHP 3 October 26th, 2013 06:59 PM
Typos???? stret67 BOOK: Beginning Android Tablet Application Development 0 September 25th, 2011 06:25 PM
Invalid Characters dnayak XSLT 1 April 19th, 2008 02:22 AM





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