Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the 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 22nd, 2004, 10:38 AM
Authorized User
 
Join Date: Jul 2004
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default Beginning Visual C# Exercises - Chapter 08

1. Public, Private and Protected

2. False, although, when resources are critical, calling a destructor is more timely

3. No, static properties, fields and methods may be independent of object instances

4.
Code:
                   |---------------|
                   |  HotDrink     |
                   |---------------|
                   |  Milk         |             |---------------|
                   |  Sugar        |             | <<Interface>> |
                   |---------------|             |    ICup       |
                   |  Drink()      |             |---------------|
                   |  AddMilk()    |             |  Color        |
                   |  AddSugar()   |             |  Volume       |
                   |---------------|             |---------------|
                           ^                     |  Refill()     |
                           |                     |  Wash()       |
                           |                     |---------------|
           |-----------------------------|
           |                             |
           |                             |
   |---------------|           |---------------|
   |  CupOfCoffee  |---() ICup |  CupOfTea     |---() ICup
   |---------------|           |---------------|
   |  BeanType     |           |  LeafType     |
   |---------------|           |---------------|
   |               |           |               |
   |---------------|           |---------------|
5. private void slakeThirst(object beverage)
        {
            // Employ interface polymorphism
            ICup glassWare;
            glassWare = beverage;
            glassWare.AddMilk();
            glassWare.Drink();
            glassWare.Wash();
        }
 
Old July 22nd, 2004, 12:04 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Wow, cool ASCI art.

Unfortunately I don't have the book, so I cannot say whether your design is correct or not.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 26th, 2004, 07:11 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Steven, you are doing a great favor to the readers of this book, I appreciate your efforts and kindheartedness.

Ankur





Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginning Visual C# Exercises - Chapter 05 seblake C# 1 July 26th, 2004 07:40 AM
Beginning Visual C# Exercises - Chapter 04 seblake C# 0 July 21st, 2004 09:21 AM
Beginning Visual C# Exercises - Chapter 07 seblake C# 0 July 20th, 2004 02:07 PM
Beginning Visual C# Exercises - Chapter 06 seblake C# 1 July 19th, 2004 09:15 AM





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