you mean, not actually write the constructor fucntion in, but still have whatever you're working with (i'm assuming a class...please correct me if i'm worng) still pass through your compiler's debugger?
No I mean a virtual constructor,<br>
with the keyword VIRTUAL i.e<br>
class A<br>
{<br>
virtual A()<br>
{<br>
}<br>
}<br>
<br>
I would like to know if you can have this kind of construct or not if nit why ?
If you are really interested in virtual constructors, also known as factory function, I would recommend you take a look at Scott Meyers book "Effective C++ (Second Edition)", pp. 149-152.<br>
<br>
He dedicates a few pages to virtual constructors and why you would want to create one. While you can't really put "virtual" on a constructor like you have in your example, the idea is similar. Virtual constructors return pointers to dynamically allocated objects that support the class interface.<br>
<br>
<br>
<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.