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 |
Explain what is the most efficient way to store flag values?
what is the advantage of software development
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
What is the difference between strcpy() and memcpy() function in c programming?
Can u return two values using return keyword? If yes, how? If no, why?
#include<stdio.h> #include<conio.h> void main() { float a; clrscr(); a=0.5; if(a==0.5) printf("yes"); else printf("no"); getch(); }
what is the difference between const volatile int i & volatile const int j;
What are c identifiers?
Where static variables are stored in c?
write a program to swap two numbers without using temporary variable?
What is the difference between fread buffer() and fwrite buffer()?
Is null valid for pointers to functions?