Methods (OOP) (OCR A-Level Computer Science): Flashcards
📚Flashcards
Practise the cards
12 cards from this deck
ShowHide
Practise the cards
12 cards from this deck
Methods in OOP (definition)
Methods in OOP (definition)
Functions defined within a class representing object behaviours
Public methods accessibility
Public methods accessibility
Accessible from outside the class
Public methods role
Public methods role
Primary interface of a class for external interaction
Public methods encapsulation benefit
Public methods encapsulation benefit
Allow access without exposing internal workings of class
Private methods accessibility
Private methods accessibility
Intended for internal use only, not accessible externally
Private methods Python naming
Private methods Python naming
Marked by leading underscore (e.g., _method_name)
Private methods purpose
Private methods purpose
Perform auxiliary/supportive tasks within the class
Private methods security benefit
Private methods security benefit
Help keep implementation details hidden (encapsulation)
Accessing private methods externally
Accessing private methods externally
Should be avoided (breaks convention/encapsulation)
Python private method convention
Python private method convention
Should start with single underscore
Private methods & data security
Private methods & data security
Help protect internal processes, promoting encapsulation
Modular design with private methods
Modular design with private methods
Segment complex actions into smaller, maintainable methods
