Sign In
Ask Question
Jayla Bryant
Computers & Technology
17 October, 11:40
What is the purpose of a constructor?
+5
Answers (
1
)
Nico Gallegos
17 October, 11:45
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?
Find an answer to your question 👍
“What is the purpose of a constructor? ...”
in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers
You Might be Interested in
If a driver who is under the age of 21 is stopped by a law enforcement officer and has a blood alcohol level of 0.02 or greater driving privilege for the driver will be suspended for?
Answers (1)
What is the name of the redesign heuristic that suggests checking the completeness and correctness of incoming materials?
Answers (1)
int) You are the head of a division of a big Silicon Valley company and have assigned one of your engineers, Jim, the job of devising an algorithm to sort through an English text of n words and convert it into an Esperanto document.
Answers (1)
How do you calculate the life span of patents? Calculation of the life span of patents starts from the date on which you ___ the patent application.
Answers (1)
What part of the computer gives access to the internet
Answers (1)
New Questions in Computers & Technology
Which is a value of the Scrum Manifesto? a. working software over comprehensive documentation b. we provide experiences that challenge and support students c. respect for the individual, striving for excellence and acting with integrity d.
Answers (1)
What screen enables you to customize how files will be saved on your computer? a. Save Options b. Word Options c. Save As Options d. Auto Options
Answers (1)
Arrange the following storage media in descending order of storage capacity:Zip disk, a standard floppy disk, a compact disc, 123, 321,132, 312
Answers (1)
Jacob wants to be a Steamfitter. He just finished his associate's degree. Which best describes what he should do next? A. Get a bachelor's degree. B. Do a three - to five-year apprenticeship. C. Get a master's degree. D.
Answers (2)
what is the difference between a packet filtering firewall and a dynamic stateful inspection firewall?
Answers (1)
Home
»
Computers & Technology
» What is the purpose of a constructor?
Sign In
Sign Up
Forgot Password?