When I inherit this class in another component, like this below and I have two the same components on grasshopper canvas. One of them will overwrite/change variables such as preview, bbox, m, lines, directory or other variables from base class. Will it only be affected/changed for one component only while other will have initial values?
That should work fine. This is what I use for GhShaderNodes as well, where I actually have a chain of base classes:
I have a CyclesNode class deriving from GH_Component. This is where I essentially dynamically create the inputs and outputs based on the types in ccl.ShaderNodes.* and some extra stuff for the heavy lifting. Then for the math nodes I have yet another base class MathBaseNode deriving from CyclesNode.
To make a GH_Component base class, declare it as abstract to force inheritors to overwrite methods that it does not overwrite, such as Guid, It’s just good practice I think.
Regarding your question, it depends on the implementation. If the fields are not declared static, in principle they should not share the values.