simple program for virtual function?
Answer / shafi . shaik
//The Concepts of interface classes in Java (Function
Overriding
#include<iostream.h>
#include<conio.h>
class A
{
public:
virtual void cal()
{
}
};
class B:public A
{
public:
void cal()
{
cout<<"Addition"<<10+20;
}
};
class C:public A
{
public:
void cal()
{
cout<<"Multiplication"<<10*20;
}
};
void main()
{
clrscr();
A *p;
B ob;
C ob1;
p=&ob;
p->cal();
p=&ob1;
p->cal();
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
How would you print out the data in a binary tree, level by level, starting at the top?
what will be the output for the following main() { printf("hi" "hello"); }
4) Write a program that takes a 5 digit number and calculates 2 power that number and prints it. i have done maximum par but i m findind problem in the commented area. please help...
Can we use visual studio for c?
How do I access command-line arguments?
what is a headerfile?and what will be a program without it explain nan example?
Describe the modifier in c?
How to convert a binary number to Hexa decimal number?? (Note:Do not convert it into binary and to Hexadecimal)
Where register variables are stored in c?
What is the use of #include in c?
what value is returned to operating system after program execution?
write a program to fined second smallest and largest element in a given series of elements (without sorting)