␡
- Constructors
- Error Handling
- The Importance of Scope
- Operator Overloading
- Multiple Inheritance
- Object Operations
- Conclusion
- References
- Example Code Used in This Chapter
< Back
Page 9 of 9
This chapter is from the book
Example Code Used in This Chapter
The following code is presented in C# .NET. Code for other languages, such as VB .NET and Objective-C, are available electronically on the publisher’s website. These examples correspond to the Java code that is listed inside the chapter itself.
The TestNumber Example: C# .NET
using System; namespace TestNumber { class Program { public static void Main() { Number number1 = new Number(); Number number2 = new Number(); Number number3 = new Number(); } } public class Number { int count = 0; // available to both method1 and method2 public void method1() { count = 1; } public void method2() { count = 2; } } }
< Back
Page 9 of 9