# Сокрытие методов

Использование модификатора `new` позволяет скрыть переопределенный метод за новым, с таким же названием. Новый метод может иметь отличную сигнатуру. Сокрытие методов не следует путать с переопределением методов, потому что сокрытие методов не позволяет использовать полиморфизм.

```csharp
class Foo : Object {
    public void my_method() { }
}

class Bar : Foo {
    public new void my_method() { }
}
```

Вы все еще можете вызвать первоначальный метод приведения к основному классу, или интерфейсу:

```csharp
void main() {
    var bar = new Bar();
    bar.my_method();
    (bar as Foo).my_method();
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vala.gitbook.io/vala/untitled/oop/hiding-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
