This way you can do:
#include <iostream>
>
> using namespace std;
>
> class A {
> public:
> int a;
>
> A(int m) {
> a = m;
> }
>
> A() {
> }
> };
>
> int main()
> {
> int i;
>
> A *obj[32];
>
> for ( i = 0; i <= 31; i++ ) {
> obj[i] = new A(i);
> }
>
> for ( i = 0; i <= 31; i++ ) {
> cout << obj[i]->a << endl;
> }
>
> return 0;
> }
>
On Tue, May 24, 2011 at 9:42 PM, Balaji S <[email protected]> wrote:
> Answer pls.. ;-)
>
> Class A
> {
> int a;
>
> public:
>
> A(int m = 0)
> {
> a = m;
> }
>
> int main()
> {
> int i = 0;
>
> /*
> Create the 32 Objects { nObjects[32] } of Class A
> &&
> Initialize the nObjects[i].a = i during the constructor call ( 0 <= i <= 31
> )
> */
> }
> --
> With Regards,
> Balaji.S
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
-Aakash Johari
(IIIT Allahabad)
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.