4.8. Test Your Understanding

 < Day Day Up > 


What are the advantages of using a class factory to create objects?


Which class should custom exceptions inherit from? Which constructors should be included?


How does the default System.Object.Equals method determine if two objects are equal?


Which interface(s) must a class implement in order to support the foreach statement?


What is the main advantage of using generics?


What is the purpose of implementing IDisposable on a class?


Refer to the following code:

 public class test: ICloneable {    public int Age;    public string Name;    public test(string myname)    { Name = myname;    }    public Object Clone()    { return MemberwiseClone(); } } // Create instances of class test myTest = new test("Joanna"); myTest.Age = 36; test clone1 = (test) mytest.Clone(); test clone2 = myTest; 

Indicate whether the following statements evaluate to TRue or false:

  1.  Object.ReferenceEquals(myTest.Name, clone1.Name) 

  2.  Object.ReferenceEquals(myTest.Age, clone1.Age) 

  3.  myTest.Name = "Julie"; Object.ReferenceEquals(myTest.Name, clone1.Name) 

  4.  Object.ReferenceEquals(myTest.Name, clone2.Name) 


How does implementing Finalize on an object affect its Garbage Collection?

     < Day Day Up > 

    Core C# and  .NET
    Core C# and .NET
    ISBN: 131472275
    EAN: N/A
    Year: 2005
    Pages: 219

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