[Interest] how to create 2-D array of object whose constructor contains parameters in C++

程梁 chengliang.soft at gmail.com
Mon Jul 2 02:57:43 CEST 2012


You could do this like:

1.
class clazz {
public:
    int num;
};

clazz arr[3] = { clazz(1), clazz(2) };

OR

2. support default constructor with default parameters values or setters.

You could not dynamic create arrays with new using the first way.

That all I new. Hope this could help you.

2012/7/1 Vincent Cai <wcai at cypress.com>

>  Hi,****
>
> ** **
>
>          I am sorry to post C++ question here.****
>
>          Hope somebody can help, thanks so much.****
>
> ** **
>
> Vincent.****
>
> ------------------------------
> This message and any attachments may contain Cypress (or its subsidiaries)
> confidential information. If it has been received in error, please advise
> the sender and immediately delete this message.
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>


-- 
Cheng Liang <http://about.me/devbean>
Nanjing, China
http://www.devbean.info
from: devbean at devbean.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120702/d580471c/attachment.html>


More information about the Interest mailing list