Python Tutorial 40 --- "Class Methods As Alternative Constructors (OOPS 5)"
Python Tutorial 40 --- "Class Methods As Alternative Constructors (OOPS 5)" In this tutorial, we will learn how we can convert a class method into an alternating constructor. This tutorial is not about "what," as we have seen in previous tutorials, where we learn about new concepts or functionality. But this one is about" how." We will focus more on implementation as we are already familiar with all the concepts we are going to use. In this tutorial, we are going to learn some new skills or techniques other than a new concept. We learned about constructor and its functionality in tutorial #55, where we had to set all the values as parameters to a constructor. Now we will learn how to use a method as a constructor. It has its own advantages. By using a method as a constructor, we would be able to pass the values to it using a string. Note that we are talking about a class method, not a static method. The parameters that we have to pass to our constructor w...