You have one base class virtual function how will call that
function from derived class?

Answer Posted / narendra

class A
{
public:
virtual void fun()
{
cout<<"class A\n";
}
};
class B:public A
{
public:
virtual void fun()
{
cout<<"class B\n";
A::fun(); //calling base class virtual function.
}
};

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is abstraction in oop?

644


Can we define a class within the interface?

559


Why is object oriented programming so hard?

618


How to hide the base class functionality in Inheritance?

642


given a set based questions and 5 questions based on it next data sufficiciency questions 2 and 2/3 english sentence completion with options very easy and 2 synononmys paragraph with 10 questions 10 minutes replace =,-,*,% with -,%,+,* type questions 5 3 questions lik following itssickhere itssickthere itssickhere istsickhere which is nt alike the others very easy

2150






What are oops functions?

590


What is polymorphism used for?

578


Why is static class not inherited?

601


What is constructor overloading in oop?

607


What are objects in oop?

612


Why do we use polymorphism?

583


What is this pointer in oop?

558


Give two or more real cenario of virtual function and vertual object

1858


Question: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date.

635


What is oops in simple words?

585