search
Log In
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
4 votes
2.6k views

What is the right way to declare a copy constructor of a class if the name of the class is MyClass?

  1. MyClass (constant MyClass * arg)
  2. MyClass (constant MyClass & arg)
  3. MyClass (MyClass arg)
  4. MyClass (MyClass * arg)
in Object Oriented Programming 2.6k views

2 Answers

5 votes
 
Best answer
it should be B (with a const keyword instead of constant )as reference of arg is passed in copy constructor

selected by
2
@sanjay :is there any book of Java that contain conceptual questions of Java.

Like test your c skill for c language
2 votes
In the question, a particular language is not mentioned so option B and C both are correct.

In Java copy constructor: MyClass(MyClass arg)

But In C++ it is :  MyClass (constant MyClass & arg)
Answer:

Related questions

4 votes
2 answers
1
2.9k views
In graphics, the number of vanishing points depends on The number of axes cut by the projection plane The center of projection The number of axes which are parallel to the projection plane The perspective projections of any set of parallel lines that are not parallel to the projection plane
asked Jun 5, 2016 in Computer Graphics makhdoom ghaya 2.9k views
3 votes
1 answer
2
2.5k views
The built-in base class in java, which is used to handle all exceptions is Raise Exception Error Throwable
asked Jun 5, 2016 in Java makhdoom ghaya 2.5k views
1 vote
1 answer
3
2k views
Which of the following is not provided as a service in cloud computing? Infrastructure as a service Architecture as a service Software as a service Platform as a service
asked Jun 5, 2016 in Cloud Computing makhdoom ghaya 2k views
7 votes
2 answers
4
7.1k views
If a program $P$ calls two subprograms $P1$ and $P2$ and $P1$ can fail $50$% of the time and $P2$ can fail $40$% of the time, what is the failure rate of program $P$? $50$% $60$% $70$% $10$%
asked May 12, 2016 in IS&Software Engineering makhdoom ghaya 7.1k views
...