Sign In
Ask Question
Computers & Technology
Emerson Yates
10 February, 09:01
What is the purpose of a constructor?
+1
Answers (
1
)
Evelin Morrow
10 February, 10:57
0
The main purpose of the constructor in the computer science is to initialize the object of the class. The constructor is basically called after the allocation of the memory in the object. When the object is created, the constructor are basically used to initialize as default value.
Constructor is also known as special type of the member function. The compiler called the constructor whenever the object has been create and the construction has similar name of the given class.
Example:
Class test () {
int p, r; / / variable declaration
public:
/ / constructor
/ / Assigning value in the constructor
p=5;
r=10;
Cout<<" Constructor value/n";
}
Comment
Complaint
Link
Know the Answer?
Answer
Not Sure About the Answer?
Get an answer to your question ✅
“What is the purpose of a constructor? ...”
in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers
You Might be Interested in
The ability of a person booking a flight on Southwest's website to reserve a car from Dollar Rent-A-Car without having to leave the airline's website is an example of the usage by Dollar Rent-A-Car and Southwest Airlines of which of the following?
Answers (1)
When a windows computer starts, it initiates the stateless address autoconfiguration process, during which it assigns each interface a link-local unicast address. what is the order of steps involved in this autoconfiguration process?
Answers (1)
before Katie turns in the paper she typed she wants a peer to review it and give her feedback Katie uses her all in one printer to scan who edits print and send them to her brain an all-in-one printer is a
Answers (1)
An information system should collect data from both external and internal sources, although organizational objectives and the type of application also determine what sources to use.
Answers (1)
While working on a group project, you notice something does not look right in the presentation. You call a meeting with your team. At the meeting, everyone works together to identify what is missing, define what needs to be done, and assign tasks.
Answers (1)
New Questions in Computers & Technology
What is the reminder after dividing 8x^3 + 6x^2 - 3x + 1 by 2x^2 x + 2
Answers (1)
Rockstar Software, Inc., develops a new series of performance-related video games. This software is most likely protected by
Answers (1)
If you turn your volume to loud on u'r headphones can it break the sound quality of the speaker?
Answers (2)
Players who skate in a crouched position prefer sticks with a low lie. The observation is a type of
Answers (1)
Which osi layer defines the functions of logical network-wide addressing and routing?
Answers (1)
Home
»
Computers & Technology
» What is the purpose of a constructor?
Sign In
Sign Up
Forgot Password?