Constructors and inheritance

Cards (4)

  • CLASS Pet
    PRIVATE name
    PUBLIC PROCEDURE NEW(givenName)
    Name = givenName
    ENDPROCEDURE
    ENDCLASS
  • SUPER.methodName(parameters) -
  • CLASS dog INHERITS Pet
    PRIVATE breed
    PUBLIC PROCEDURE NEW(givenName, givenBreed)
    SUPER.NEW(givenName)
    BREED = givenBreed
    ENDPROCEDURE
    ENDCLASS
  • how to create an instance of an object?
    objectName = NEW className(parameters)
    e.g
    myDog = NEW Dog(“Fido”, “Scottish Terrier”)