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
Some touch screens recognize when you touch the screen with two fingers or two hands. if you are looking for a device on which you can do this, what type of touch screen should you search for?
Answers (1)
A computer database uses a binary sequence of 5 bits to represent unique user IDs. To increase the number of unique IDs that the database is able to represent, the database administrator increases the number of bits in a user ID to 12 bits.
Answers (1)
What step of execution in the Y86 SEQ processor reads a value from data memory or writes a value to data memory? Select one: a. Fetch b. Decode c. Write back d. Memory e. Execute f. PC update
Answers (1)
How do you make your graphics ADA accessible in BlueGriffon? A. Type in alternate text B. Type in a Tooltip C. Make the filename descriptive D. All of the above are correct
Answers (1)
What kind of negative social impact has wireless communications had on today's society?
Answers (2)
New Questions in Computers & Technology
Cables intended for indoor use which consist of a number of twisted wire pairs, usually four, wrapped in a protective jacket are called?
Answers (1)
Which of the following statements is true of the term "FTTH"? 1. It refers to high-speed data lines provided by many firms all across the world that interconnect and collectively form the core of the Internet. 2.
Answers (1)
MySQL 8 is the first version that supports JSON Objects. (a) True (b) False
Answers (1)
Find the complete predicate in the sentence below. Roy ate at my house last night. A) ate. B) ate at my house. C) ate at my house last night. D) Roy ate
Answers (1)
Why are we not alowed to have are phones at school?
Answers (2)
Home
»
Computers & Technology
» What is the purpose of a constructor?
Sign In
Sign Up
Forgot Password?