Skip to content

Instantly share code, notes, and snippets.

@naveda89
Last active August 29, 2015 14:07
Show Gist options
  • Save naveda89/08b6b89d91c2b10aabcd to your computer and use it in GitHub Desktop.
Save naveda89/08b6b89d91c2b10aabcd to your computer and use it in GitHub Desktop.
class Classname
constructor: (@args...) ->
# returns itself
console.log regularFunction()
instanceMethod: (args) ->
"return from instanceMethod"
_privateInstanceMethod: () ->
"return from private instanceMethod"
@CONSTANT = "value of a constant"
@classMethod: (args) ->
"return from classMethod"
@_privateClassMethod: () ->
"return from private classMethod"
property: "value of an object property"
regularFunction = () =>
"return from a regular old function"
@CONSTANT
regularVarialbe = "value of a regular old variable"
instance = new Classname
# console.log instance
# console.log instance.instanceMethod()
# console.log instance._privateInstanceMethod()
# console.log Classname.CONSTANT
# console.log Classname.classMethod()
# console.log Classname._privateClassMethod()
# console.log instance.property
# console.log regularFunction() # not defined (protected)
# console.log regularVariable # not defined (protected)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment