Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
h9230669
h9230669's Profile
1
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
override in processing 1.51
[3 Replies]
12-May-2013 08:26 AM
Forum:
Programming Questions
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";
but seems it cannot using override in processing
ps. I'm using processing 1.51
«Prev
Next »
Moderate user : h9230669
Forum