lilzz
Posts: 411
Joined: Sat Nov 30, 2013 5:27 pm

Following C++ Array questions.

Wed Nov 19, 2014 10:12 pm

1) ClassA &* tempA;
I guess that's a pointer to a reference. Why do you need a pointer to a reference? isn't a reference almost like a pointer itself.

2) ClassB<templA, templB>Ar (3, 4, 1)
what does it means <templA, templB> ? I have seen one template parameter inside but not two. What's (3, 4, 1)? Array initialization? An array of 3 initialized to 3, 4, 1?

3)[*ilx](index)
what's this ? dereference of ilx and then [ ] and a parameter of index?

Heater
Posts: 15950
Joined: Tue Jul 17, 2012 3:02 pm

Re: Following C++ Array questions.

Thu Nov 20, 2014 3:12 am

lilzz,

You have a lot of these little C/C++ puzzles for us. Without any particular project/purpose in mind. You know, there are many books on the language that contain the answers.

Please be so kind as to acknowledge the comments to your last puzzle before we move on to this next batch.
Memory in C++ is a leaky abstraction .

User avatar
DougieLawson
Posts: 39124
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Following C++ Array questions.

Thu Nov 20, 2014 9:46 am

I wonder if we're being used as Lilzz's online homework answer generator. Perhaps we should all give the wrong answers so that she fails with a D- grade.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26660
Joined: Sat Jul 30, 2011 7:41 pm

Re: Following C++ Array questions.

Thu Nov 20, 2014 9:54 am

lilzz wrote:1) ClassA &* tempA;
I guess that's a pointer to a reference. Why do you need a pointer to a reference? isn't a reference almost like a pointer itself.

2) ClassB<templA, templB>Ar (3, 4, 1)
what does it means <templA, templB> ? I have seen one template parameter inside but not two. What's (3, 4, 1)? Array initialization? An array of 3 initialized to 3, 4, 1?

3)[*ilx](index)
what's this ? dereference of ilx and then [ ] and a parameter of index?
1. Reference to a pointer?
2. Template can have as many parameters as you want. The parameters will depend on the template/class definition.
3. A pointer to a function which is called with the parameter index

As others have said, you have posted a lot of c++ etc questions recently, none of which appear to be Pi related. Please consider using a C++ forum for these types of questions, or searching up front with Google.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

Heater
Posts: 15950
Joined: Tue Jul 17, 2012 3:02 pm

Re: Following C++ Array questions.

Thu Nov 20, 2014 12:10 pm

Are 1) and 2) trick questions? I can't see how they will even compile.
Memory in C++ is a leaky abstraction .

Return to “C/C++”