0

can i write a function in contrustor c++?

2nd Oct 2022, 1:57 PM
Khaled
Khaled - avatar
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; }
25th Oct 2022, 2:35 AM
Sickfic
Sickfic - avatar