ChapterFivePartIII

Chapterfivepartiii

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: IT108 Introduction to Methods – Part III George Mason University Irene Bruno, modified by Bill Pegram Overloading Methods • Overloaded methods will have same name but different signatures (number of parameters, , order of parameters, or datatype of parameters) • One can’t overload based on different return type • Overloading should only be used when the various versions of the method do roughly the same thing Overloading Methods Listing 5.3 Overloading the max Method public static double max(double num1, double num2) { if (num1 > num2) return num1; else return num2; } Ambiguous Invocation Sometimes there may be two or more possible matches for an invocation of a method, but the compiler cannot determine the most...
View Full Document

This note was uploaded on 01/26/2012 for the course IT 108, 103, taught by Professor Bruno during the Spring '11 term at George Mason.

Ask a homework question - tutors are online