Weird polymorphism c++? -


this question has answer here:

anyone can explain weird bit in line of code me?

classa::classa(std::string aname) : name(aname)

appearantly, declaration of class

class classa { public:     std::string name;     classa(std::string aname); }; 

and weird line of code appeared in cpp file

classa::classa(std::string aname) : name(aname) 

it's not polymorphism right? then, it?

this constructor initialization list:

 classa::classa(std::string aname)   : name(aname) // constructor initialization list  {    // ctor body. name initialized here  } 

it means data member name gets initialized value of aname.

it orthogonal polymorphism.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -