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;
find the occurence of zy in the final string
Aim: To implement a program to create, update & display account & admin record of person using display account & admin records of person using virtual base class.. Code:
We are now quite happy to use the basic mathematical expressions, however in engineering we use scientific functions i.e Sin , Cos , ln etc . Within C we have the following functi
can we use const data member in static. member function with example.
Problem #1: plugging the memory leak. When you employ the "normal" new operator, for example Foo* p = new Foo(), the compiler generates some special code to manage the case while t
Program: Write a program that predicts users' age (0-128 years old) with at most 7 questions. The game starts with asking the user whether he/she is younger or older than G (an
Operation Files 2.1. Your program should open and read the file specified by the first command line argument of the program. 2.2. The first line of the file contains an integer
Make the following 3 functions work by filling in appropriate C code. This file 1. // Write a function to count the number of particular characters in a string. // Do not use a
what is a variable
Observe that our model of evaluation allows for combinations whose operators are compound expressions. (a) Use this observation to describe the behavior of the following procedu
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