296 Object-Based Programming Chapter (Free web hosting with ftp) 8 4 using System;
296 Object-Based Programming Chapter 8 4 using System; using System.Windows.Forms; 6 7 // TimeTest2 demonstrates constructors of class Time2 8 class TimeTest2 9 { // main entry point for application 11 static void Main( string[] args ) 12 { 13 Time2 time1, time2, time3, time4, time5, time6; 14 time1 = new Time2(); // 00:00:00 16 time2 = new Time2( 2 ); // 02:00:00 17 time3 = new Time2( 21, 34 ); // 21:34:00 18 time4 = new Time2( 12, 25, 42 ); // 12:25:42 19 time5 = new Time2( 27, 74, 99 ); // 00:00:00 time6 = new Time2( time4 ); // 12:25:42 21 22 String output = “Constructed with: ” + 23 “ntime1: all arguments defaulted” + 24 “nt” + time1.ToUniversalString() + “nt” + time1.ToStandardString(); 26 27 output += “ntime2: hour specified; minute and ” + 28 “second defaulted” + 29 “nt” + time2.ToUniversalString() + “nt” + time2.ToStandardString(); 31 32 output += “ntime3: hour and minute specified; ” + 33 “second defaulted” + 34 “nt” + time3.ToUniversalString() + “nt” + time3.ToStandardString(); 36 37 output += “ntime4: hour, minute, and second specified” + 38 “nt” + time4.ToUniversalString() + 39 “nt” + time4.ToStandardString(); 41 output += “ntime5: all invalid values specified” + 42 “nt” + time5.ToUniversalString() + 43 “nt” + time5.ToStandardString(); 44 output += “ntime6: Time2 object time4 specified” + 46 “nt” + time6.ToUniversalString() + 47 “nt” + time6.ToStandardString(); 48 49 MessageBox.Show( output, “Demonstrating Overloaded Constructors” ); 51 52 } // end method Main 53 54 } // end class TimeTest2 Fig. 8.5 Fig. 8.Fig.Fi 8.5g. 8.55Overloaded constructor demonstration. (Part 2 of 3.) Fig. 8.
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.