On Tue, Sep 15, 2009 at 7:15 AM, Rick Moynihan <[email protected]> wrote: > > Hi all, > > I'm looking at extending a java class in clojure, however I can't find > any mention of how to access or change state within my super class > object e.g. given a java class like this: > > public class Foo { > protected int foo = 10; > // ... > } > > How can I write the equivalent of this in clojure? : > > public class Bar extends Foo { > public void setFoo() { > foo = 30; > } > } > > Neither gen-class nor proxy seem to mention how one can access or > mutate member variables. I would have thought instance variables > would be accessible and mutatable within some kind of binding...
gen-class has an :exposes option that allows you to create getter and setter methods for super class protected fields. --Chouser --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---
