M
Markos Charatzas
Hello to all,
Suppose we have a class Ship and a class Cabin.
Both of these classes support a common interface, say Query and Cabin is
part of Ship. Therefore,
class Ship implements Query
{
String name;
Cabin cabin;
public String getQuery()
{
}
}
class Cabin implements Query
{
public String getQuery()
{
}
}
Now, inside cabin.getQuery() I need to know the ship.name value.
What's the best approach to achieve this? Should I pass a reference of
Ship in Cabin once a cabin object is created? Any other possible way?
Thanks in advance,
Markos Charatzas
Suppose we have a class Ship and a class Cabin.
Both of these classes support a common interface, say Query and Cabin is
part of Ship. Therefore,
class Ship implements Query
{
String name;
Cabin cabin;
public String getQuery()
{
}
}
class Cabin implements Query
{
public String getQuery()
{
}
}
Now, inside cabin.getQuery() I need to know the ship.name value.
What's the best approach to achieve this? Should I pass a reference of
Ship in Cabin once a cabin object is created? Any other possible way?
Thanks in advance,
Markos Charatzas