ssiva raman wrote:1/ i thought i used a valid names for all these?did you find anything wrong?can you be more specific?
2/ to let cat object to access dog object's name field.
3/ you mean inheritance?
1/ Yes, otherwise I would not have mentioned it. An extra tip: classes (methods and variables are ok).
2/ A cat HAS-A name, I never knew of a cat having a dog, so dog should not be a data member. If a cat can provoke a dog, you provide a dog parameter to the provokeDog-method (as you already did in your code snippet).