Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Virtual Functions
The keyword virtual was previously used to resolve ambiguity for a class derived from two classes, both having a common ancestor. These classes are known as virtual base classes. This time it helps in implementing the idea of polymorphism with class inheritance. The function of the base class can be declared with the keyword virtual. The program with this change and its output is given below.
class Shape
{
public :
virtual void print()
cout << " I am a Shape " << endl;
}
};
class Triangle : public Shape
void print()
cout << " I am a Triangle " << endl;
class Circle : public Shape
cout << " I am a Circle " << endl;
void main()
Shape S;
Triangle T;
Circle C;
S.print();
T.print();
C.print();
Shape *ptr;
ptr = &S;
ptr -> print();
ptr = &T;
ptr = &C;
Write a program which incorporates a function named compute and which is used to calculate the area and circumference of a circle. Use the main function for inputs and outputs.
there is a pebble merchant. he sells the pebbles,that are used for shining the floor.his main duty is to take the length of the room side but he sometines mistakes doing that and m
Write a ''C'' program to accept any 3 digit integer number from the keyboard and display the word equivalent representation of the given number.
write a cprogram to calculate fraction through recursion
Q: How Virtual functions call is maintained?
want the codings for these topic in ur experts minds.com
Write a method (belonging to the TermStructure class) that takes a pointer to an array of bonds and an integer, representing the number of bonds in the array as arguments, and esti
C Program for SORTING OF LONG WORD WITH DIFFERENT STRING #include stdio.h> #include conio.h> #include string.h> void main() { char n[50],c[25][25]
Define Generic Bitwise Operations? Bitwise operators only work on an incomplete number of types int and char. It turns out there's above one kind of int. In particular there's
Determine the types of Container class Container class can be of 2 types: - Heterogeneous container - Here container class comprise a group of mixed objects - Homogeneou
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd