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 |
There is a practice in coding to keep some code blocks in comment symbols than delete it when debugging. How this affect when debugging?
Explain data types & how many data types supported by c?
What is structure of c program?
What is function pointer and where we will use it
int i[2], j; int *pi;i[0] = 1; i[1] = 5; pi = i; j = *pi + 1 + *(pi + 1)Value of j after execution of the above statements will be a) 7 b) 6 c) 4 d) pointer
void main(int argc,char *argv[],char *env[]) { int i; for(i=1;i<argc;i++) printf("%s",env[i]); }
Give a method to count the number of ones in a 32 bit number?
what is the value of 'i'? i=strlen("Blue")+strlen("People")/strlen("Red")-strlen("green")
7 Answers Cadence, JNTU, Zen Technologies,
program for following output using for loop? 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
What is this pointer in c plus plus?
Describe for loop and write a c program to sum the series X + x2/2! + x3 /3! + …….. up to fifteen terms.
What are the advantages of using new operator as compared to the function malloc ()?