Review Questions

   


1:

List three kinds of data abstractions where structs should be considered instead of classes.

2:

Mention the important similarities and differences between classes and structs.

3:

If myStruct is a value type, how is the following call possible if WriteLine only accepts reference types?

 Console.WriteLine("Details of myStruct" + myStruct); 
4:

Can a struct have an explicit default constructor?

5:

Why is boxing called boxing?

6:

Suppose the struct Fraction contains the two public data members numerator and denominator. Fraction does not contain any explicitly defined constructors. You now write the following code:

 Fraction myFraction; myFraction.ToString(); 

Is the second line valid? Why or why not?


   


C# Primer Plus
C Primer Plus (5th Edition)
ISBN: 0672326965
EAN: 2147483647
Year: 2000
Pages: 286
Authors: Stephen Prata

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net