In this tutorial, I'll first describe the basics of defining classes in C#, including instance members, access modifiers, constructors, and initialization lists, and then I'll move on to defining static members and the difference between constant and read-only fields. After that, I'll cover destructors and something called deterministic finalization.Finally, the tutorial will wrap up with a quick discussion of inheritance and C# classes.
Classes
Classes are at the heart of every object-oriented language. As discussed in tutorial 1, "Fundamentals of Object-Oriented Programming," a class is the encapsulation of data and the methods that work on that data. That's true in any object-oriented language. What differentiates the languages from that point on are the types of data you can store as members and the capabilities of each class type. With classes, as with a lot of the language's features, C# borrows a little from C++ and Java and adds some ingenuity to create elegant solutions to old problems.
by
updated