# Class, setter and getter

**URL:** <https://forum.kirupa.com/t/class-setter-and-getter/115787>\
**Category:** Uncategorized\
**Created:** [July 11, 2004, 11:45pm UTC](https://forum.kirupa.com/t/class-setter-and-getter/115787 "2004-07-11T23:45:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Chen](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@Michael\_Chen](https://forum.kirupa.com/u/Michael_Chen)\
**Post date:** [July 11, 2004, 11:45pm UTC](https://forum.kirupa.com/t/class-setter-and-getter/115787/1 "2004-07-11T23:45:36Z")

</div>

Hi Everyone 🙂

Does anyone use this kind of syntax for creating the setter and getter for their custom classes?

public function get foo():dataType {  
return \_foo;  
}  
public function set foo(value:dataType):Void {

}

Does the above syntax have any advantages over the bottom one?  
I find the top one quite confusing (esp. with the extra space).

public function getFoo():dataType {  
return \_foo;  
}  
public function setFoo(value:dataType):Void {

}

Thanks in advance :sure:
