104 - The 11th Zhejiang University Programming Contest - D
If it looks like a duck, swims like a duck, and quacks like a duck, then it probably is a duck.
When I see a bird that walks like a duck and swims like a duck and quacks like a duck, I call that bird a duck.
In computer programming with object-oriented programming languages, duck typing is a style of dynamic typing in which an object's current set of methods and properties determines the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface.
Given a chunk of code, your task is to tell the function of each statement. Each statement is a line of one of the following formats:
All ClassName and MethodName are valid identifiers, namely a sequence of one or more ASCII letters, digits (these may not appear as the first character), and underscores. Both the length of the identifier and the depth of inheritance tree don't exceed 20.
There are multiple test cases. The first line of input is an integer T ≈ 10 indicating the number of test cases.
Each test case is a chunk of code. There is a blank line after each test case.
For each statement, output as the description says. Output a blank line after each test case.
3 begin class Sub:Super class Super class Sub:Super end begin class Class call Class.Method def Class.Method call Class.Method end begin class Super class Sub:Super def Super.Method call Sub.Method end
oops! class Super class Sub:Super class Class oops! def Class.Method invoke Class.Method class Super class Sub:Super def Super.Method invoke Super.Method
Author: Local Contests 2011 Committee
Contest: The 11th Zhejiang University Programming Contest