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
What are the benefits if you pay off all your high-interest debt such as credit cards and store cards? A. I'll free up money that could be invested. B. I'll lower my debt-to-income ratio. C. I'll save a lot of money in interest charges. D.
Answers (2)
How many kilowatts does a 4watt nightlight bulb use in 24hours?
Answers (1)
Which os the following is NOT true about the proof of work concept? -It is the proof of the validity of a block in a blockchain. -It is created when a current block hash combines the transaction data with the hash of the previous block.
Answers (1)
A simple CPM network has five activities, A, B, C, D, and E. A is an immediate predecessor of C and of D. B is also an immediate predecessor of C and of D. C and D are both immediate predecessors of E.
Answers (1)
ethical standards in business are principals or codes for how a business conducts itself with___, customers, and the public.
Answers (1)
New Questions in Computers & Technology
Which property of a text element controls how the browser handles text that does not fit within the element box? A. width B. overflow C. padding D. margin
Answers (1)
What is the term for movement in particular direction
Answers (2)
How accurate is the usps expected delivery date?
Answers (1)
When reassembling your pc what does the text recommend as the first step?
Answers (1)
During a test, it is okay to click on any of Blackboard's navigation buttons, the Refresh button, or your browser's Back button. True / False.
Answers (1)
Home
»
Computers & Technology
» What is the purpose of a constructor?
Sign In
Sign Up
Forgot Password?