# Using a class as a function?

**URL:** <https://forum.kirupa.com/t/using-a-class-as-a-function/276533>\
**Category:** Uncategorized\
**Created:** [November 30, 2008, 9:54am UTC](https://forum.kirupa.com/t/using-a-class-as-a-function/276533 "2008-11-30T09:54:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rustyleaf](https://avatars.discourse-cdn.com/v4/letter/r/a3d4f5/32.png) [@rustyleaf](https://forum.kirupa.com/u/rustyleaf)\
**Post date:** [November 30, 2008, 9:54am UTC](https://forum.kirupa.com/t/using-a-class-as-a-function/276533/1 "2008-11-30T09:54:57Z")

</div>

Is there anyway of using a class as a glorified function? I was asked about using a Timer Class yesterday, but it seems the thread has got lost during maintenance???

My aim is to send the the event.target.name and another string to a function - have it perform a series of case statements and return a string based on the calculations. It is however a very long series of case statements and would clutter up my document class quite considerably, especially if I need more than one of these “functions”.

So what I don’t currently understand and am trying vehemently to understand is how I might use a class to do this for me? I can’t see how this “function” can be an object? Can I perform a get statement on the result of this function or something, but I would still need to parse the information to it?

I hope you can understand my ignorance and perhaps enlighten me a little??? I have looked on the forums but cant find anything I quite fully understand, I daren’t say it is a flaw with OOP - I thinks its a flaw with my logic… many thanks!
