0

What does mean by explicitly and implicitly called? In constructor and destructor. When does implicitly get called?

7th Dec 2016, 7:40 PM
Abhijeet Farakate
Abhijeet Farakate - avatar
3 Antworten
+ 1
I am not sure about constructors but destructors only called implicitly. You cannot call destructor in your code, it is called when program exits.
7th Dec 2016, 8:29 PM
ayşegül şen
ayşegül şen - avatar
0
Destructor will be called for stack objects as soon as the end of it's scope is reached. For heap objects you created via "new" you should call delete later. This will trigger the destructor here.
17th Jan 2017, 9:12 PM
Micha Rumler
Micha Rumler - avatar
0
implicitly is something u directly use without sending as an argument in a function.. for eg class A{ int x; public: void readx(int y) { x=y;. // here you are directly accessing the private member. } int random(A z){ A p; p.x=x+z.x;}// here z is an object passed explicitly }; void main() { A a,b; a.random(b)}
9th Feb 2017, 5:35 PM
swetha sri sridhara
swetha sri sridhara - avatar