






Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







Using Overloaded Members
(Example 1)
The ToString() method of numeric data types is overloaded One method accepts no arguments and converts the value to a string A second method accepts one argument – a format string Examples:
lblToString1.Text = _ System.Int32.MaxValue.ToString() lblToString2.Text = _ System.Int32.MaxValue.ToString("C")
Using Overloaded Members
(Example 2)
The StreamWriter constructor is overloaded Note the two different argument lists If the file exists, it will be overwritten CurrentWriter = new _ StreamWriter(ofdCurrent.FileName)
Use the second argument to append to a file CurrentWriter = new StreamWriter(ofdCurrent.FileName, True)
Rules for Overloading Members
By creating multiple members having the same name, those members will be considered overloaded Constructors can be overloaded Return data type for overloaded methods must be the same
Overloading Members (Example)
The declaration for three overloaded members (see IS389OverloadingCSharp.zip for code)
How .NET Calls an
Overloaded Member
UML Class diagrams
(Overloading)