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

class and objects

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


weaknessforcats
Expert Mod 5K+
P: 9,186
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
Sep 16 '18 #2

Post your reply

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