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 |
What is C language ?
What are the different types of errors?
Is c is a high level language?
Explain what is the benefit of using enum to declare a constant?
How to use c/c++ code in JAVA
10 Answers CDAC, IBM, Satyam, Scope International,
what is the use of call back function in c?tell me with example
Write a program with dynamically allocation of variable.
Write a program to add the following ¼+2/4+3/4+5/3+6/3+... (Like up to any 12 no.s)
why we use pointer in c
Explain how do you sort filenames in a directory?
what is stack , heap ,code segment,and data segment
What is RAM memory? and What is ROM?Who designed one is temparary and another is permanent?why they designed like that?By using far pointer which type data(whether hexadecimal)we can access?