Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


simple program for virtual function?



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

Post New Answer

More C Interview Questions

How macro execution is faster than function ?

0 Answers   Wipro,


Write a program that can show the multiplication table.

0 Answers   Student,


What is the output of the following program main();{printf ("chennai""superkings"}; a. Chennai b. superkings c. error d. Chennai superkings

6 Answers  


what is an inline function?

2 Answers   TCS,


What is C++

4 Answers  


difference between memcpy and strcpy

1 Answers  


what does ‘segmentation violation’ mean?

1 Answers  


input may any number except 1,output will always 1.. conditions only one variable should be declare,don't use operators,expressions,array,structure

4 Answers   IBM,


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

0 Answers  


write a program whose output will be- 1 12 123 1234

10 Answers  


Why main is used in c?

0 Answers  


Multiply an Integer Number by 2 Without Using Multiplication Operator

0 Answers  


Categories