Skip to content
Justice Tech School

C# Classes and Objects

A class is a blueprint and an object is an instance made with new. Classes hold fields, properties and methods. Access modifiers are public, private, protected and internal.

Example
class Student
{
    public string Name = "";
    public int Score;
    public string Describe() => $"{Name}: {Score}";
}
var s = new Student { Name = "Ada", Score = 70 };
Console.WriteLine(s.Describe());

Exercise

Create an object.

var s =  Student();

Quiz Test

Which keyword makes an object?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.