Hi,
I'm making a program using Visual Studio 2010. I'm strugging with how to correctly use classes and their instances.
For example; What is the difference between using the following ways to call function from one class within another...
Example 1:
Dialog.h
#include OtherClass.h
MyOtherClass myClass;
Dialog.cpp
myClass.MyFunction();
Example 2:
Dialog.h
#include OtherClass.h
MyOtherClass *myClass;
Dialog.cpp
myClass->MyFunction();
What I am finding difficult is how to call functions of a class from multiple other classes without creating new instances in each one. E.g. I create an instance of a serial port class in my dialoge class, do some comminication, then some code in another class wants to do some serial coms, but it can't because I can only acess the port in the original instance of the serial class.
I hope my questions make some sense, I'm really newbie to the object oriented stuff.