Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "ctor" stand for in class constructors?

I've often seen the word "ctor" used in class constructors. What does it mean?

like image 748
Robin Rodricks Avatar asked Feb 22 '11 13:02

Robin Rodricks


People also ask

What is ctor in constructor?

In class-based object-oriented programming, a constructor (abbreviation: ctor) is a special type of subroutine called to create an object. It prepares the new object for use, often accepting arguments that the constructor uses to set required member variables.

What does ctor mean in Java?

A constructor in Java is a special method that is used to initialize objects. The constructor is called when an object of a class is created.

What is ctor in Javascript?

Ctor passes the "member init" function the parent prototype, so it can easily call methods on it when extending a parent method. This provides super -like functionality simply and without undue magic.

What is the constructor in a class?

A constructor of a class is a special method that gets called when a class is instantiated using the NEW function. A constructor for a class has the same name as the class name. Unlike ordinary methods, a constructor definition is identified by the CONSTRUCTOR statement.


2 Answers

Yes, It does stand for ConstrucTOR.

Btw, it is used as a shortcut for writing the default constructor in Visual C#.
Try, [ctor + press tab twice] = default constructor.

like image 191
Saurabh Gokhale Avatar answered Oct 10 '22 20:10

Saurabh Gokhale


That is a short name of ConstrucTOR

like image 26
artyom.stv Avatar answered Oct 10 '22 20:10

artyom.stv