I do have a basic question about inheritance and classes.
How would you create an real world object of a tree (a real tree).
Tree should have branches, branches should have leaves.
So:
class Tree {
// something about a tree itself
}
Class Branch : Tree {
//something about a branch
}
Class Leaf : Branch {
//something about a leaf
}
But now, should a tree class know about all the branches instances and create all the branches objects itself while the branches should create leaves for themselves and also know about them ?
So to just put a tree you would:
Tree myNewTree = new Tree(); // or something like that ?
I think i got something back to front here... Examples of a shape - > rectangle and you ask for rectangle makes sense.