|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
|
|
#1
|
|||
|
|||
|
Constructor Functions
Hi,
Why Constructor function has same name as Class? Is there any valid point ? Why it should not have different name? Suri |
|
#2
|
||||
|
||||
|
A contructor function has the same name as the class because it is to be called when the object is created. This is done so that you don't have to call a seperate function at that time, just create the object and it calls this function automatically.
|
|
#3
|
|||
|
|||
|
if you donīt like it, try another programming language.
in delphi eg. you can name the constructor / destructor whatever you want... the result is, that unlike C++, you have to tell which constructor to use: myObject:=TClass.Create();
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#4
|
|||
|
|||
|
I like it one less line of code to type....:
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Constructor Functions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|