I am a very beginner. I am self taught and learning as I go. My question is after I create the functions. How do I invoke them in main()? Below is my code, but it is only 40% done. If anyone can just explain the concept of calling the function. I thought and read it was className.memberfunction() so in my case class Road.getLength(), but it does not work.
You create an object of type Road and then call methods from the object:
Road rainbow; //this will call a default built-in constructor since there are none present in the Road class
int kappa = rainbow.getWidth(); //this calls getWidth() method which returns rainbow.global_Length
If global_Length was a public variable, inside of main you could do this (I would not recommend this):
int kappa = rainbow.global_Length;
I usually think of methods as descriptors, actions, and states that help define the object and what it can do.
I'm not sure why you made an object on the heap(besides that isn't how you make a dynamic object, Road ptrroad = new Road;), it would be better to have it on the stack in this case. Anyways, moving on to your question.
When it gets to cin >> Thickness it's simply going to get confused on what your float variable Thickness is because it isn't in scope. Make it a private member of your class and see what you can figure out from there.