# Protected

An access level visible to the class itself and its child classes only.

## What is **Protected**?

`protected` is an access level that hides a member from outside code but still lets child classes use it.

```csharp
public class Animal
{
    protected int energy = 10;
}

public class Dog : Animal
{
    public void Run() => energy -= 2; // allowed: Dog is a child class
}
```

Level: Apprentice · [More OOP terms at this level](https://www.ask-codey.com/glossary/subjects/oop/apprentice)

Updated: September 27, 2026

## In other subjects

- [protected in C#](https://www.ask-codey.com/glossary/protected-c-sharp)
- [protected in Java](https://www.ask-codey.com/glossary/protected)

Source: https://www.ask-codey.com/glossary/protected-oop
