---
title: "Member Hiding"
content_type: tutorial
url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding?language=en"
language: en
container_type: course
container_title: "Intermediate Scripting"
container_url: "https://learn.unity.com/course/intermediate-gameplay-scripting.md?language=en&version=2019.3"
standalone_markdown_url: "https://learn.unity.com/tutorial/member-hiding.md?language=en&version=2019.3"
previous_title: "Polymorphism and casting"
previous_url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/polymorphism?language=en&version=2019.3"
previous_markdown_url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/polymorphism.md?language=en&version=2019.3"
next_title: "Overriding"
next_url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/overriding?language=en&version=2019.3"
next_markdown_url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/overriding.md?language=en&version=2019.3"
difficulty: intermediate
duration_minutes: 5
unity_version:
  - "2019.3"
  - "2019.2"
  - "2019.1"
  - "2018.4"
  - "2018.3"
  - "2018.2"
  - "2018.1"
  - "2017.4"
  - "2017.3"
  - "2017.2"
  - "2017.1"
  - "5.x"
  - "4.x"
supported_unity_versions:
  - name: "2019.3"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2019.3"
  - name: "2019.2"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2019.2"
  - name: "2019.1"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2019.1"
  - name: "2018.4"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2018.4"
  - name: "2018.3"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2018.3"
  - name: "2018.2"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2018.2"
  - name: "2018.1"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2018.1"
  - name: "2017.4"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2017.4"
  - name: "2017.3"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2017.3"
  - name: "2017.2"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2017.2"
  - name: "2017.1"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=2017.1"
  - name: "5.x"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=5.x"
  - name: "4.x"
    url: "https://learn.unity.com/course/intermediate-gameplay-scripting/tutorial/member-hiding.md?language=en&version=4.x"
last_updated: "2026-08-04T14:23:55.000Z"
---

# Member Hiding

Explore how to hide base class members in derived classes using C# inheritance.

How to implement the hiding of base members in derived classes.

## 1. Member Hiding

[Video](https://connect-mediagw.unity.com/h1/20220110/videos/1278ec3b-764f-4d2f-a109-f6ff615d70fa_U_Intermediate_8_MemberHiding.mp4) ([Transcript (en)](https://connect-mediagw.unity.com/h1/20220111/d272e82d-1b45-463c-b84d-1259ba7ba5e2_I_08_Member_Hiding_v2.0.vtt))

**Humanoid Class**

```csharp
using UnityEngine;
using System.Collections;

public class Humanoid
{
    //Base version of the Yell method
    public void Yell()
    {
        Debug.Log ("Humanoid version of the Yell() method");
    }
}
```

**Enemy Class**

```csharp
using UnityEngine;
using System.Collections;

public class Enemy : Humanoid
{
    //This hides the Humanoid version.
    new public void Yell()
    {
        Debug.Log ("Enemy version of the Yell() method");
    }
}
```

**Orc Class**

```csharp
using UnityEngine;
using System.Collections;

public class Orc : Enemy
{
    //This hides the Enemy version.
    new public void Yell()
    {
        Debug.Log ("Orc version of the Yell() method");
    }
}
```

**WarBand Class**

```csharp
using UnityEngine;
using System.Collections;

public class WarBand : MonoBehaviour 
{
    void Start () 
    {
        Humanoid human = new Humanoid();
        Humanoid enemy = new Enemy();
        Humanoid orc = new Orc();

        //Notice how each Humanoid variable contains
        //a reference to a different class in the
        //inheritance hierarchy, yet each of them
        //calls the Humanoid Yell() method.
        human.Yell();
        enemy.Yell();
        orc.Yell();
    }
}
```
