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
0 votes
221 views

How many constructors can a class have ?

  1. zero               
  2. 1           
  3. 2                  
  4. any number
in Object Oriented Programming
edited by
221 views

2 Answers

2 votes
 
Best answer
Any number of constructors are allowed, provided their parameters differ from each other.

Example-

Class A{

int a, b;

A(){

this.a=5;

}

A(int a){

this.a=a;

}

A(int a, int b){

this.a=a;

this.b=b;

}

}

selected by
0 votes
Ans: D

Related questions

0 votes
1 answer
1
427 views
A copy constructor is invoked when : a function returns by value an argument is passed by value a function returns by reference none of the above
asked Sep 26, 2017 in Object Oriented Programming rishu_darkshadow 427 views
0 votes
1 answer
2
374 views
When a language has the capability to produce new data types, it is said to be : extensible encapsulated overloaded none of the above
asked Sep 26, 2017 in Object Oriented Programming rishu_darkshadow 374 views
1 vote
1 answer
3
2 votes
2 answers
4
1.2k views
Which of the following is used to make an Abstract class? Making at least one member function as pure virtual function Making at least one member function as virtual function Declaring as Abstract class using virtual keyword Declaring as Abstract class using static keyword
asked Aug 9, 2016 in Object Oriented Programming jothee 1.2k views
...