Geometry
Complete version (all in one file) - All 57 sections combined in a single document for easy reading or printing.
Table of Contents
- 1 - Introduction to OOP
- 1.1 Summary
- 1.2 Creating a class
- 1.3 Using a class
- 1.4 Constructors
- 1.5 Static versus non-static
- 1.6 Class diagram
- 2 - Encapsulation and constructor chaining
- 2.1 Summary
- 2.2 Encapsulation
- 2.3 Constants
- 2.4 Constructor chaining
- 2.5 Arrays of objects
- 2.6 Class diagram
- 3 - Classes as attribute (Point, Circle, Rectangle)
- 3.1 Summary
- 3.2 Classes as attribute
- 3.3 Class diagram
- 3.4 Relationship between Circle and Point
- 3.5 The Rectangle class
- 3.6 Class diagram
- 3.7 Code for Point class
- 3.8 Code for Rectangle class
- 4 - Inheritance and ToString
- 4.1 Summary
- 4.2 Shape base class
- 4.3 Circle as derived class
- 4.4 Rectangle as derived class
- 4.5 Class diagram
- 4.6 ToString method
- 4.7 Code for Shape class
- 5 - Polymorphism and abstract classes
- 5.1 Summary
- 5.2 Polymorphism
- 5.3 Abstract classes
- 5.4 Class diagram
- 5.5 Nullable and value types
- 6 - Lists and type checking (is/as)
- 6.1 Summary
- 6.2 List
- 6.3 For loop through List
- 6.4 Surface class
- 6.5 Type checking and casting
- 6.6 Class diagram
- 7 - Interfaces (IComparable)
- 7.1 Summary
- 7.2 IComparable interface
- 7.3 Class diagram
- 8 - Exceptions
- 8.1 Summary
- 8.2 Exceptions
- 9 - File input and output
- 9.1 Summary
- 9.2 Reading from a file
- 9.3 Writing to a file
- 10 - Database access (ADO.NET with MySQL)
- 10.1 Summary
- 10.2 Setting up database and writing points
- 10.3 Reading points
- 10.4 DbAccess class
- 10.5 PointDao class
- 10.6 CircleDao class
- 10.7 Auto-increment values
- 11 - Database continued (AbstractDao)
- 11.1 Summary
- 11.2 AbstractDao class
- 11.3 Adapt PointDao
- 11.4 Refactor CircleDao
Structure
Each chapter is in its own folder with separate markdown files per section. Use the Table of Contents above to jump to any section.
Image List
Images Overview - All images on one page with descriptions.
Supporting files
Conventions
- Language: English (translated from Dutch)
- Code: C# with .NET 8
- Conventions: C# Coding Standards
- Data folder:
Data/Rectangle.csvfor chapter 9;Data/CreateInsertScriptShapes.sqlfor chapters 10-11
Database (chapters 10-11)
- Run
Data/CreateInsertScriptShapes.sqlin MySQL Workbench - Add NuGet package:
MySql.Data - Adjust connection string if your MySQL setup differs
Back to: Overview