78.4k views
1 vote
What's the definition of constructors

User JSBach
by
5.6k points

2 Answers

0 votes
When a class or struct is created, its constructor is called. Constructors have the same name as the class or struct, and they usually initialize the data members of the new object. In the following example, a class named Taxi is defined by using a simple constructor
User Tary
by
5.7k points
4 votes
A constructor is an object-oriented program and is formed when a class or struct is created. 
User Userx
by
6.0k points