What is constructor and virtual function?

Answer Posted / lakshmi

Constructor is the function that has class name as its
function name with no return type and is used to initialize
the data members of the class.
virtual function is the function that can be overriden in
the derived class. it uses virtual keyword. it may or may
not be overloaded in derived class.
abstract function must be overridden in the derived class
inorder to create the instance.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does regex mean?

571


Which collection allows duplicate values in java?

546


How do you print array in java?

556


Where import statement is used in a java program?

610


What is the current version of java?

543






What are different data structures in java?

534


What is a file pointer?

516


What is empty string literal in java?

562


What do you understand by casting in java language?

578


What do you mean by inner class in java? Explain

588


Why hashcode is used in java?

500


Which collections are thread safe in java?

479


What is a class reference?

554


Why string is immutable or final in java

613


How many threads does a core java have?

509