dcsimg
why cann't i make an explicit call to the constructor...
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Yogesh_Gupta
Posted On:   Saturday, February 17, 2001 06:18 AM

why cann't i make an explicit call to the constructor of any class as below:
class Sample
{
//contains class definition
}
when i create an object of the class as below:
Sample s1=new Sample();
and if i try to call the Sample(int) constructor for the class as below it reports me an error:
s1.Sample(10);

why does this happens and is there any way to do this?

Re: why cann't i make an explicit call to the constructor...

Posted By:   gopi_namani  
Posted On:   Tuesday, January 22, 2002 12:25 PM

In first case you are invoking the default constructor and in the later case the constructor with integer doesn't exist thats why it is giving an error.
About | Sitemap | Contact