#if my virtual function takes a struct type defined in the base class as a parameter
4 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
provided the struct definition is public, any code can access it and use it to call your virtual function. no need to redefine it
class base {
public:
struct my_struct {};
virtual void func(my_struct s) = 0;
};
class derived : public base {
void func(my_struct s) override { /* ... */ }
};
// ...
// Usage
base::my_struct s;
derived d;
d.func(s); // ok