public class greeting {
public String name;
public greeting () { this.name = “gima326”; }
public greeting (String name){ this.name = name; }
public String hello (){ return “Hi-sai, ” + this.name + “!”; }
public String hello2 (String name){ return “Cha-bira-sai, ” + name + “!”; }
}
// clojure =====================
(def hello-extndr2
(proxy [greeting] []
;; fnc1
(hello []
(do
;; extended part
(println (format "1: Sent a Greeting to %s." (.name this)))
;; original part
(println (proxy-super hello))))
;; fnc2
(hello2 [name-added]
(do
;; extended part
(println (format "2: Sent a Greeting to %s." (.name this)))
;; original part
(println (proxy-super hello2 name-added))))
))
//============================
user=> (.hello (greeting.))
"Hi-sai, gima326!"
user=> (.hello (greeting. "aaa"))
"Hi-sai, aaa!"
user=> (.hello2 (greeting. "aaa") "bbb")
"Cha-bira-sai, bbb!"
user=> (.hello hello-extndr2)
1: Sent a Greeting to gima326.
Hi-sai, gima326!
nil
user=> (.hello2 hello-extndr2 "bbb")
2: Sent a Greeting to gima326.
Cha-bira-sai, bbb!
nil
//============================
user=> (ancestors (class hello-extndr))
{demo.example.greeting java.lang.Object clojure.lang.IProxy}
user=> (ancestors (class hello-extndr2))
demo.example.greeting java.lang.Object clojure.lang.IProxy}
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.