lundi 27 décembre 2021

parameters r=0 , i=0 in a constructor

so I was just learning about polymorphism in oops , I was being taught operator overloading in a program that adds complex numbers; so there is this class and it's constructor but the constructor is like

complex(int r=0 , i=0){...}

my question is what does r=0 mean as a parameter ? what I am guessing is when I don't pass the values in the constructor when creating an object then the program takes 0 as default value;

if so then can I do the same with normal functions ?

Aucun commentaire:

Enregistrer un commentaire