override in processing 1.51
in
Programming Questions
•
5 months ago
Hello, I'm trying to use some override Technic in processing
However I found it's a little wired,
here's a small example....
- class father{
- String a = "i am father";
- father(){}
- public void printa() {println(this.a);}
- }
- class child extends father{
- String a = "i am child";
- child(){}
- }
- void setup(){
- father f = new father();
- child c = new child();
- f.printa();
- c.printa();
- }
this will printout these two lines...
- i am father
- i am father
But I already declare the child's value as "i am child"
why I still get the parent's value with method printa() ?
is this not possible to make > child class use child value by using father method ?
please help, thanx ... <(_ _)>
ps. my friend said maybe i should using "override" in child class just like in java
- override string a= "i am child";
ps. I'm using processing 1.51
1