# Member Functions

Classes may declare member functions that each instance of the class may call.

Declaring a member function is done with `member function declare start`. It takes in the function's privacy (as `public`,`protected`, or`private`), name in PascalCase, return type, and any number of (name, type) pairs of parameters.

```
class start : Announcer
    member variable declare : private Greeting string

    member function declare start : public Greet void name string
        print : { concatenate : { member variable : private { this } Greeting } (", ") name "!" }
    member function declare end

    constructor start : public Announcer greeting string
        operation : { member variable : private { this } Greeting } equals greeting
    constructor end
class end
```

In C#:

```csharp
using System;

class Announcer
{
    private string greeting;

    public void Greet(string name)
    {
        Console.WriteLine(this.greeting + ", " + name + "!");
    }

    Announcer(string greeting)
    {
        this.greeting = greeting;
    }
}
```

In Python:

```python
class Announcer:
    def greet(self, name):
        print(self.__greeting + ", + " + name + "!")

    def __init__(self, string):
        self.__greeting = greeting
```

## Calling

Call member functions with the `member function` command. It takes in the same function privacy, , caller's name, and any number of parameters.

```
member function : public announcer Greet ("Sample")
```

* In C#: `announcer.Greet("Sample");`
* In Python: `announcer.greet("sample")`


---

# 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://docs.budgielang.org/syntax/classes/member-functions.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.
