langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
|
|
@ -0,0 +1 @@
|
|||
SomeClass.staticMethod()
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
objectInstance = SomeClass() -- create a new instance of the class
|
||||
objectInstance.instanceMethod() -- call the instance method
|
||||
|
||||
SomeClass().instanceMethod() -- same as above; create a new instance of the class and call the instance method immediately
|
||||
|
|
@ -0,0 +1 @@
|
|||
my_obj#my_meth params
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ClassName->some_function(); # call class function
|
||||
instance->some_method(); # call instance method
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
// Class
|
||||
[MyClass method:someParameter];
|
||||
// or equivalently:
|
||||
id foo = [MyClass class];
|
||||
[foo method:someParameter];
|
||||
|
||||
// Instance
|
||||
[myInstance method:someParameter];
|
||||
|
||||
// Method with multiple arguments
|
||||
[myInstance methodWithRed:arg1 green:arg2 blue:arg3];
|
||||
|
||||
// Method with no arguments
|
||||
[myInstance method];
|
||||
28
Task/Call-an-object-method/PL-SQL/call-an-object-method.sql
Normal file
28
Task/Call-an-object-method/PL-SQL/call-an-object-method.sql
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
create or replace TYPE myClass AS OBJECT (
|
||||
-- A class needs at least one member even though we don't use it
|
||||
dummy NUMBER,
|
||||
STATIC FUNCTION static_method RETURN VARCHAR2,
|
||||
MEMBER FUNCTION instance_method RETURN VARCHAR2
|
||||
);
|
||||
/
|
||||
CREATE OR REPLACE TYPE BODY myClass AS
|
||||
STATIC FUNCTION static_method RETURN VARCHAR2 IS
|
||||
BEGIN
|
||||
RETURN 'Called myClass.static_method';
|
||||
END static_method;
|
||||
|
||||
MEMBER FUNCTION instance_method RETURN VARCHAR2 IS
|
||||
BEGIN
|
||||
RETURN 'Called myClass.instance_method';
|
||||
END instance_method;
|
||||
END;
|
||||
/
|
||||
|
||||
DECLARE
|
||||
myInstance myClass;
|
||||
BEGIN
|
||||
myInstance := myClass(null);
|
||||
DBMS_OUTPUT.put_line( myClass.static_method() );
|
||||
DBMS_OUTPUT.put_line( myInstance.instance_method() );
|
||||
END;
|
||||
/
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
ClassName.methodname(); # call class method
|
||||
$instance.methodname(); # call instance method
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
obj->method();
|
||||
obj["method"]();
|
||||
call_function(obj->method);
|
||||
call_function(obj["method"]);
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
function func = obj->method;
|
||||
func();
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
module.func();
|
||||
module["func"]();
|
||||
Loading…
Add table
Add a link
Reference in a new issue