Skip to content

Instantly share code, notes, and snippets.

@luizcalaca
Created April 7, 2024 19:33
Show Gist options
  • Save luizcalaca/8d9473ac64970d48038647b9ccaf03f5 to your computer and use it in GitHub Desktop.
Save luizcalaca/8d9473ac64970d48038647b9ccaf03f5 to your computer and use it in GitHub Desktop.
Python OOP
# arquivo soma.py
class Soma():
def __init__(self, name: str) -> None:
self.name = name
def sum(self, a, b) -> int:
return a + b
def str_name(self) -> str:
return self.name
obj = Soma("Sum")
print(obj.sum(8,9))
print(obj.str_name())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment