Oct-14-2018, 06:47 AM
(Oct-14-2018, 04:26 AM)CxxJxxYxx Wrote: May I ask why the 'tree' in 'print(tree.report(1))' isn't capitalized? I am confused about this point. Because in previous sentences nothing is defined as 'tree', but only the class 'Tree'
I think this is about my example.
Tree
is the class. tree
is just a variable name, i.e. it could be whatever you want. So tree
is an instance of class Tree
. It's created on line #18. You are not correct there is nothing defined as tree. From my example:#example how to instanciate object of class Tree #ignore numbers if they don't make business sense tree = Tree(block=1, plot=5, species=7, dhb=200) print(tree.report(1))Once again - tree is just variable, instance of Tree. You may have many instances of a class in your code.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs