Signed up recently but had issues with the confirmation email?
Click Forgot password and follow the reset steps. You can choose the same password you used when you signed up. This should then provide access.
Remember to check Spam and Junk. The email will be from auth@progressbytes.co.uk.
Use of object oriented techniques.
2.2.1 Programming Techniques
Practise exam questionsProgramming Techniques — Note 6 of 6
Candidates need to understand classes, objects, attributes, methods, encapsulation (including get and set methods), inheritance and polymorphism. Candidates need to be able to read, trace and write object-oriented code, interpret class diagrams to produce class definitions, and derive an object-oriented solution for a given scenario.
Object-oriented techniques are used to design and write programs as collections of interacting objects. You need to read, trace and write OOP code, interpret class diagrams, and decide when an object-oriented approach suits a problem.
draw().class Shape:
def __init__(self, name):
self.__name = name # private attribute
def get_name(self): # getter
return self.__name
def area(self):
return 0
class Rectangle(Shape): # inheritance
def __init__(self, width, height):
super().__init__("Rectangle")
self.width = width
self.height = height
def area(self): # overrides Shape.area (polymorphism)
return self.width * self.height
shapes = [Shape("Blank"), Rectangle(3, 4)]
for s in shapes:
print(s.get_name(), s.area()) # Blank 0, then Rectangle 12A diagram showing each class's name, attributes and methods (with + for public and - for private), and arrows showing inheritance.
super.new(...), then sets its new attributes. Don't assign the parent's private attributes directly from the subclass..length(). Write in pseudocode or one language, not a mix.new with the class name and the constructor's arguments in order, strings in quotes, e.g. boat = new Boat("Swift", 4). In a main program, store or test the value each FUNCTION method returns before you act on it.public function getSpeed() return speed endfunction. It only takes a parameter when it returns one element of an array attribute, e.g. getSeat(row) returns seats[row]. A setter takes the new value as a parameter; it doesn't input it.givenName = name the wrong way round, or using input in the constructor. Parameters belong to new(...), each is assigned TO its attribute (name = givenName), and fixed starting values are set inside it, not passed in. If asked for the class declaration AND the constructor, write both: the class ... endclass lines with the attributes, and public procedure new(...) inside.Past exam questions
Ready to test yourself?
Practise 2.2.1 questions