I have this structure:
class Base
{
public:
void doACopy(char* strToCopy) {
strcpy(str, strToCopy);
}
private:
char str[4];
};
class Derived : public Base
{
public:
void doSomething() {
char toCopy[4];
toCopy[0] = 'a'; toCopy[1] = 'b'; toCopy[2] = 'c';
Base::doACopy(toCopy); // is there any problem passing toCopy here?
}
};
I know toCopy is allocated on stack. Is there any problem on passing this array to super, in this case Derived::doACopy?