Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

A Python Class Constructor

class Person:
  def __init__(self, fname, lname):
    self.fname = fname
    self.lname = lname

p1 = Person("John", "Smith")

print(p1.fname)
print(p1.lname)
 
PREVIOUS NEXT
Tagged: #A #Python #Class #Constructor
ADD COMMENT
Topic
Name
3+6 =