C# Basics – Classes – Part 11

We introduce classes in C# programming language in this tutorial.


Andraz Krzisnik
C# Basics – Classes – Part 11

Classes

Class is basically a container of functions. It can be a separate file or it can be written in the same file as your main project file. We can also create a custom object with properties we define.

We briefly touched the subject of access keywords that determine how accessible is some object or a variable.

  • An object, when set to private, is accessible only within the curly brackets it’s been declared in.
  • An object, when set to public, is accessible from outside the curly brackets it’s been declared in.
  • An object, when set to protected, is accessible only within the curly brackets it’s been declared in and in it’s inherited classes.
Download Examples Next Chapter
Show Comments (0)

Comments

Related Articles

C# Basics

C# Basics – Static Methods – Part 14

Static Methods Now what exactly are static methods and what is their purpose? Let’s first take a look at a static method Sqrt from the class Math. If we think about how did...

Posted on by Andraz Krzisnik
C# Basics

C# Basics – Conditional Statements – Part 5

Conditional Statements There is a data type for logic operations, called bool. Possible values that this kind of variable can hold are true and false. Let’s take a look at logic...

Posted on by Andraz Krzisnik