# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + [markdown] id="j5kQX0js8KwS"
# **Declaring a Class Syntax**

# + id="iReGrEsN75Pw"
class Employee:
  pass


# + [markdown] id="lpM002qE8Y_7"
# **Creating a Class with Attributes and Declaring a Object**

# + colab={"base_uri": "https://localhost:8080/"} id="R9O7Sj5Z8oS8" outputId="f7cc8cd7-f16e-45d2-c84f-2b86dcfbc468"
class Employee:
  #class attributes
  role = "Developer"
  dateofjoining="2021-09-21"

  def getrole(self):
    print("Role: ",self.role)

#Driver code
shyam = Employee()


#get object value of a attribute
print(shyam.role)

#call a function from object
shyam.getrole()


# + [markdown] id="M21ltveC-cN8"
# **Class using __init__ method and self parameter**

# + colab={"base_uri": "https://localhost:8080/"} id="eH65_TNI-iHJ" outputId="3b81e7bf-3cc7-4582-bc68-4a34be8765bc"
class Employee:

  def __init__(self,role):
    self.role = role

  def getrole(self):
    print("Role: ",self.role)

#Driver code
shyam = Employee('Developer')
shyam.getrole()


StarcoderdataJupyterScriptsDedupFiltered