Constructor and Destructor of C++ in Punjabi language
Computer Gyan
Constructor Constructor is declared by naming a member function with the same name as the class. The constructor function will be called automatically when a new instance of the class is created. Means A class constructor is a special member function of a class that is executed whenever we create new objects of that class.A constructor will have exact same name as the class and it does not have any return type not even void. Destructor:- A Destructor is a function that automatically executes when an object is destroyed. It is executed when an instance of the class to which it belongs goes out of class or goes out of existence. Some rules for writing a destructor function are:
- The name of destructor is the same as that of class.
- The first character of name must be tilde (~)
- It cannot be overloaded.
- It has no return type.
- It cannot accept any parameters.
Constructor overloading:- When we have more thn one constructor in a class.
For more information visit https://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm https://www.studytonight.com/cpp/constructors-and-destructors-in-cpp.php https://www.geeksforgeeks.org/difference-between-constructor-and-destructor-in-c/ music information: You’re free to use this song in any of your videos, but you must include the following in your video description: I Am a Man Who Will Fight for Your Honor by Chris Zabriskie is licensed under a Creative Commons Attribution license (https://creativecommons.org/licenses/by/4.0/) Source: http://chriszabriskie.com/honor/ Artist: http://chriszabriskie.com/ ... https://www.youtube.com/watch?v=Zd3GkG5g0bc
63726108 Bytes