Answers for "python private 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
1

how to declare private attribute in python

class Base:
	def __init__(self):
    	self.__private_attribute = 2 #two underscores before attribute declare it as private
Posted by: Guest on July-24-2021

Code answers related to "python private attributes"

Python Answers by Framework

Browse Popular Code Answers by Language