| Author |
Dot Syntax for navigating classes?
|
Tye Solan
Greenhorn
Joined: Feb 17, 2011
Posts: 3
|
posted

0
|
Is there away to make
Root Workspace=new Root();
Animal Cow=new Animal();
//Parent Cow to workspace
Workspace.Cow.sound="Moo";
Workspace.Cow.color="White, black spots";
where Root and Cow are blank classes with a few properties.
So how do I parent Cow to Root? I think it has to do with super classes or something?
class Root
{
}
class Animal
{
String sound="";
String color="";
}
|
 |
Tom Reilly
Rancher
Joined: Jun 01, 2010
Posts: 618
|
posted

0
|
Yes, it has something to do with super classes or something. If you want Root to be a super class (parent) of Animal then you define Animal as:
If you want Animal to be a parent of Root then you define Root as:
|
 |
Darryl Burke
Bartender
Joined: May 03, 2008
Posts: 4167
|
posted

0
|
How does this question differ from the earlier one you never returned to?
http://www.coderanch.com/t/529886/java/java/Data-Structure
Oh, and you didn't return to this one either, not even to SayThanks.
http://www.coderanch.com/t/527777/java/java/Method-other-class-as-if
|
luck, db
There are no new questions, but there may be new answers.
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32708
|
posted

0
|
Agree. We only allow One Thread Per Question, so I am closing this thread..
|
 |
 |
|
|
subject: Dot Syntax for navigating classes?
|
|
|