another c++ q (with specialization and inheritance )

another c++ q (with specialization and inheritance )

Shachar Shemesh shachar at shemesh.biz
Tue Apr 28 12:07:52 IDT 2009


Erez D wrote:
>
>
>
>
>     Try to have gen_c2 return a pointer to c2<int>. That may resolve
>     the problem.
>
> no, it doesnt.
>
> i am sure that there is a solution to this.
Try to have gen_c2 return a pointer to c2<int>, and place the actual 
function body definition after the definition of c2.

If that fails, have gen_c2 return a pointer to c1<int>. As c1<int> is a 
public parent of c2<int>, it should amount to almost the same thing.

In any case, having a child function return a copy of a parent class is 
bad OO design.

Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting Ltd.
http://www.lingnu.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20090428/76a26da4/attachment-0001.html>


More information about the Linux-il mailing list