Re: [algogeeks] one constructor problem

2011-05-29 Thread D.N.Vishwakarma@IITR
check this sol frends #include using namespace std; class A { private: int a; public: A(int m) { a=m; } }; int main() { cout<<"Enter no of objects in array"<>n; cout<<"Enter value of a for first object of array"<>p; static A obj[]={A(p)}; for(int i=

Re: [algogeeks] one constructor problem

2011-05-27 Thread Logic King
@D.N. I Think if you removes default constructor and give only parametrized constructor...then it i going to give any errorit should work fine.. On Fri, May 27, 2011 at 4:40 AM, Aakash Johari wrote: > Provide some default value to the parameterized constructor. > * > A(int m = 0) { >

Re: [algogeeks] one constructor problem

2011-05-27 Thread Aakash Johari
Provide some default value to the parameterized constructor. * A(int m = 0) { a = m; } * On Fri, May 27, 2011 at 4:36 AM, D.N.Vishwakarma@IITR wrote: > without default constructor what will be solution > > On Wed, May 25, 2011 at 10:56 AM, Aakash Johari wrote: > >> This way you can do: >>

Re: [algogeeks] one constructor problem

2011-05-27 Thread D.N.Vishwakarma@IITR
without default constructor what will be solution On Wed, May 25, 2011 at 10:56 AM, Aakash Johari wrote: > This way you can do: > > #include > > using namespace std; > > class A { > public: > int a; > > A(int m) { > a = m; >

Re: [algogeeks] one constructor problem

2011-05-24 Thread Aakash Johari
This way you can do: #include 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

Re: [algogeeks] one constructor problem

2011-05-24 Thread immanuel kingston
http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectsbyreferencingtheconstructordirectly.htm http://www.java2s.com/Tutorial/Cpp/0180__Class/Initializeanarrayofobjectswithoutreferencingtheconstructordirectly.htm Thanks, Immanuel On Wed, May 25, 2011 at 7:34 AM, D.N.Vishwakarm

[algogeeks] one constructor problem

2011-05-24 Thread D.N.Vishwakarma@IITR
There is a class A which contains just one parameterized constructor A(int a). How would you initialize an array of objects of this class. -- **With Regards Deoki Nandan Vishwakarma IITR MCA Mathematics Department* * -- You received this message because you are subscribed to the Google Groups