Imagine you want to build a car. First you need a design: how many doors, what color, what engine type. That design itself is not yet a real car.
In software, the similar concept is a class. A class is the blueprint or template of an object.
class Araba
{
public string Marka;
public int Yil;
}
When you create a real example from the blueprint, you now have an actual object. That is called an object.
So if the class is the plan, the object is the realized version of that plan.
Araba araba1 = new Araba();
araba1.Marka = "Toyota";
araba1.Yil = 2022;
You can create multiple objects from the same class. Think of many phones of the same model, each with different colors and owners.
They all come from the same blueprint, but each object can hold different values.
Araba araba1 = new Araba();
araba1.Marka = "BMW";
Araba araba2 = new Araba();
araba2.Marka = "Mercedes";
A class can contain data, which you can think of as properties or fields. It can also contain behaviors, which are called methods.
So an object can both store information and perform actions.
class Araba
{
public string Marka;
public void Calistir()
{
Console.WriteLine("Araba çalıştı.");
}
}
Classes and objects are the foundation of object-oriented programming. They may feel abstract at first, but examples make them click quickly.