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 macro execution is faster than function ?
Write a program that can show the multiplication table.
What is the output of the following program main();{printf ("chennai""superkings"}; a. Chennai b. superkings c. error d. Chennai superkings
what is an inline function?
What is C++
difference between memcpy and strcpy
what does ‘segmentation violation’ mean?
input may any number except 1,output will always 1.. conditions only one variable should be declare,don't use operators,expressions,array,structure
What does a derived class inherit from a base class a) Only the Public members of the base class b) Only the Protected members of the base class c) Both the Public and the Protected members of the base class d) .c file
write a program whose output will be- 1 12 123 1234
Why main is used in c?
Multiply an Integer Number by 2 Without Using Multiplication Operator