General.cs
Upload User: jasonxu888
Upload Date: 2007-03-28
Package Size: 4316k
Code Size: 1k
Category:

.net

Development Platform:

C#

  1. using System;
  2. namespace General
  3. {
  4. [Serializable]
  5. public class Customer 
  6. {
  7. public String FirstName;
  8. public String LastName;
  9. public DateTime DateOfBirth;
  10. public Customer() 
  11. {
  12. Console.WriteLine("Customer.constructor: Object created");
  13. }
  14. public int getAge() 
  15. {
  16. Console.WriteLine("Customer.getAge(): Calculating age of {0}, " +
  17. "born on {1}.", 
  18. FirstName, 
  19. DateOfBirth.ToShortDateString());
  20. TimeSpan tmp = DateTime.Today.Subtract(DateOfBirth);
  21. return tmp.Days / 365; // rough estimation
  22. }
  23. }
  24. }