Review Questions



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


Mention the important similarities and differences between classes and structs.


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

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

Can a struct have an explicit default constructor?


Why is boxing called boxing?


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

Similar book on Amazon © 2008-2017.
If you may any questions please contact us: