I am a new C++ user...
I have a question regarding how to declare a member of a class \"classA\" that is an object of another class \"classB\", knowing that \"classB\" h
If you want a VideoCapture to be a member of the class, you don't want this in your class definition:
VideoCapture myCapture (string videoFileName /* : I am not sur what to put here */ ) ;
Instead you want this:
VideoCapture myCapture;
Then, your constructor can do this:
myClass::myClass (string PLEASE_GIVE_ME_A_BETTER_NAME)
: myCapture(PLEASE_GIVE_ME_A_BETTER_NAME),
videoFileName(PLEASE_GIVE_ME_A_BETTER_NAME)
{
}
What you need is initializer list:
myClass::myClass (string videoFileName) : myCapture(videoFileName) {
}
This will construct myCapture
using its constructor that takes a string
argument.