Answers for "define private class attributes python"

1

private instance attribute python

# Square Class: Define a Square with private instance
class Square:
	def __init__(self, size=0):
      # initialise variables
      self.__size = size
Posted by: Guest on June-01-2021
0

private class method python

class Student:
  def __init__(self):
    pass
  
  
  # The double underscore in the front makes it private
  def __print_name(self):
    return print("private")
  
  
  # proof of use
  def print_name(self):
    return print("public")
Posted by: Guest on February-25-2021

Code answers related to "define private class attributes python"

Python Answers by Framework

Browse Popular Code Answers by Language