Can we have a private constructor ?

Answers were Sorted based on User's Feedback



Can we have a private constructor ?..

Answer / namrata ahuja

no. constructors are always declared publicly. they are used
to initialize data members of a class. they are
automatically invoked by a class object declaration so if it
is private it cannot be invoked.

Is This Answer Correct ?    6 Yes 39 No

Can we have a private constructor ?..

Answer / ravi`

no,
we can not make a constructor private , if we make a
constructor private its method cannot access in main method .

Is This Answer Correct ?    17 Yes 136 No

Post New Answer

More OOPS Interview Questions

Can we have a private constructor ?

12 Answers   HSBC, Ness Technologies, TCS, Wipro,


Can enum be null?

0 Answers  


What are the three main types of variables?

0 Answers  


How long to learn object oriented programming?

0 Answers  


why oops need in programming

7 Answers   TCS,






Write a program to compute for numeric grades for a course. The course records are in a file that will serve as the input file. The input file is in exactly the following format: Each line contains a student's first name, then one space, then ten quiz scores all on one line. The quiz scores are in whole number and are separated by one space. Your program will take it input from this file and sends it output to a second file. The data in the output file will be exactly the same as the data in the input file except that there will be one additional number (of type double) at the end of each line. This number will be the average of the student's ten quiz scores. Use at least one function that has file streams as all or some of its arguments.

0 Answers  


How do you define social class?

0 Answers  


There are 2 classes defined as below public class A { class B b; } public class B { class A a; } compiler gives error. How to fix it?

3 Answers   Microsoft,


1. Wrie a function which returns the most frequent number in a list of integers. Handle the case of more than one number which meets this criterion. public static int[] GetFrequency(int[] list)

1 Answers   Nagarro,


wht is ditch

0 Answers  


How do you achieve polymorphism?

0 Answers  


create a c++ program that will accepts 9 inputs using 3 by 3 array.

1 Answers  


Categories