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 |
1)what are limitations for recursive function? 2)write a program to read a text file and count the number of characters in the text file
write an interactive program to generate the divisors of a given integer.
What are the 5 types of organizational structures?
Reverse a string word by word??
What are different types of operators?
What are the similarities between c and c++?
How can I set an array's size at run time?
f(*p) { p=(char *)malloc(6); p="hello"; return; } main() { char *p="bye"; f(p); printf("%s",p); } what is the o/p?
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
Why can arithmetic operations not be performed on void pointers?
How can I remove the trailing spaces from a string?
main() { printf("hello"); fork(); }