0
can i write a function in contrustor c++?
1 Answer
0
If I understand your question correctly, what would be preventing you from calling/invoking a function when your create a object of a class?
Something along the lines of:
#include <iostream>
void foo() {
std::cout << "I was invoked!\n";
}
class A {
public:
A()
{
foo();
}
};
int main() {
A obj;
}