Can a program run without main?



Can a program run without main?..

Answer / Rohit Shrivastava

In C++, constructors are special member functions used to initialize objects. By design, they do not have a return type, including 'void'. However, in some object-oriented languages like Java and C#, constructors can implicitly return the instance of the created object without an explicit return statement.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

I want to write a C++ language program that: 1. Reads in the size of a square from the screen; 2. Prints a hollow square of that size out of “-“, “|” and blanks on screen; 3. Prints the same hollow square onto a text file. The program should work for squares of all side sizes between 1 and 20.

1 Answers  


What's the order in which the local objects are destructed?

1 Answers  


Can c++ do everything c can?

1 Answers  


Explain what happens when a pointer is deleted twice?

1 Answers  


What is an incomplete type?

1 Answers  


Write an algorithm that determines whether or not an almost complete binary tree is a heap.

1 Answers   TCS,


If there are 1 to 100 Numbers in array of 101 elements. Which is the easy way to find repeated number?

2 Answers   Persistent,


What are the differences between a struct in C and in C++?

8 Answers   Amazon, Wipro,


what is polymorphism?

14 Answers   Accenture,


What is a singleton c++?

1 Answers  


What is a node class in c++?

1 Answers  


How to access a variable of the structure?

1 Answers  


Categories