Содержание
- 2. Content Introduction Defining the classes Access modifiers Defining Data and Methods Relating the C# class to
- 3. Introduction The class construct is used to support encapsulation, data abstraction, interfaces and implementation hiding. Objects
- 4. Defining the classes C# classes enable programmers to model real-world objects as objects in a program
- 5. Access Modifiers In general terms a class consists of a hidden part and an exposed part,
- 6. Defining Data Data is declared inside the class body in almost exactly the same way as
- 7. Defining Methods Methods define the behavior of an object and are where we encapsulate pieces of
- 8. Defining Methods If no data is to be returned from a method call then the keyword
- 9. Putting it All Together The following example is a first attempt at implementing a complex class.
- 10. public class Area{ //data section private double real = 0; private double imag = 0; //method
- 11. namespace ConsoleApplication3 { class Program { static void Main(string[] args) { Area a = new Area();
- 12. A reference object A complex object is created by: complex c = new complex(); However we
- 14. Скачать презентацию