# Different between private & public method in custom class

**URL:** https://forum.kirupa.com/t/different-between-private-public-method-in-custom-class/228983
**Category:** Uncategorized
**Created:** [June 13, 2007, 3:59am UTC](https://forum.kirupa.com/t/different-between-private-public-method-in-custom-class/228983 "2007-06-13T03:59:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pixeldude](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@pixeldude](https://forum.kirupa.com/u/pixeldude)
#### Post date: [June 13, 2007, 3:59am UTC](https://forum.kirupa.com/t/different-between-private-public-method-in-custom-class/228983/1 "2007-06-13T03:59:07Z")

</div>

Hi…there…

Okay just a quick shoot here…okay let’s say I have this sample class

```auto

class TestPrivate{
    
    public function TestPrivate(){};
    
    private function getGo(){
        trace("can execute");
    }
    
}

```

and then after instantiate I just calling the method…for testing the “public” and “private” keyword purposing only…

```auto

import TestPrivate;

var obj1 = new TestPrivate();
obj1.getGo();

```

the result is still can be execute eventhough I put the private keyword in front of the methods…

so what’s the private keyword stands for actually…I thought it prevent been get accessed from outside …hope someone will clearify to me…tq again…
