Answers for "python private class attributes"

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 "python private class attributes"

Python Answers by Framework

Browse Popular Code Answers by Language