Re: simple c++ question for array
hussain.rezwan@gmail.com wrote:
[...]
Say, I have 30 carriers from carrier number 35 to 65.
Unless you exclude one of the ends, it's 31 carriers. But it really
has no bearing on the problem, methinks.
Now these
carriers may be 1 bit,2 bit or 4 bits.
I can define this
b[]={1,2,4}; // b(bit loading information) is an int which can be 1,2
or 4 bits.
I am not sure I understand the problem. Why not give each carrier
a data member that would define how many bits it carries?
Do you expect 'b' to be defined outside of the 'carrier' and possibly
change at run-time to something like {3,5,7} ? What's the relationship
between a carrier and 'b' in your model?
if c is the carrier then how do I relate this c to b. For example
carrier number 36 can be 1/2 or 4 bits.
Why do you think you need to "relate" anything to anything? What is
it you're trying to model here?
Please help me. It might be a stupid question for you guys but
beginner like me want to learn the basics.
You're starting from a wrong end. First design the interface of your
carrier, then define its implementation. What's the interface? How
is it going to be used? Apparently not enough information provided.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]