423,350 Members | 2,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,350 IT Pros & Developers. It's quick & easy.

class and objects

P: 1
how can i simply pass an array from constructor without using pointers?
1 Week Ago #1
Share this Question
Share on Google+
1 Reply


weaknessforcats
Expert Mod 5K+
P: 9,166
Use a vector. Have the constructor return a copy of the vector.
True, the vector may use pointers but that's not your problem.

You could also return an object that you design that contains the array. However, you will just duplicate code in vector.


Read this:

https://bytes.com/topic/c/insights/7...rrays-revealed
1 Week Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.