c++ - can not refer to the addresses of constructors -


a constructor 'special' member function task initialize objects of class.

it special because name same class name. constructor invoked whenever an
object of associated class created.it called constructor because constructs value of data members of class.

a constructor declared , defined follows:

//class constructor class integer {     int m,n; public:     integer(void); // constructor declared };  integer::integer(void)// constructor defined {     m=0;n=0; } 

we can not refer addresses why?

because language doesn't allow way take address of constructor.

or, if you're asking why it's not allowed: because there's no reason so. you'd take address of function in order call it, , never call constructor directly. it's called indirectly, result of creating object.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -