0
What's the difference ? "I know the programme isn't right it's just an example "
class fabric class dress extends fabric fabric silk = new dress() dress silk = new dress()
4 Respostas
+ 2
They're both referring to a dress object, but they're of different types:
1) Can only access members of fabric. It may be referencing a dress object, but silk is a variable of fabric type. If you cast silk to dress, you could access all its members.
2) This is a dress-type variable referring to a dress-type object, nothing unusual.
Hope that makes sense.
0
fabric doesn't have dress attributes.
dress does have fabric attributes and its own.
^Simplified
0
no what's the difference betwen the two silk
0
thank's mate I appreciate it