What output does the following code generate? Why?
What output does it generate if you make A::Foo() a pure virtual function?
class A {
A() { this->Foo(); }
virtual void Foo() { cout << "A::Foo()" << endl; }
};
class B : public A {
B() { this->Foo(); }
virtual void Foo() { cout << "A::Foo()" << endl; }
};
int main(int, char**)
{
A objectA;
B objectB;
return 0;
}
No Answer is Posted For this Question
Be the First to Post Answer
#include<iostream.h> //main() //{ class A { friend class B; public: void read(); }; class B { public : int a,b; }; void A::read() { cout<<"welcome"; } main() { A x; B y; y.read(); } In the above program......, as B is a friend of A B can have access to all members,i cant access y.read . could you please tell me the reason and what would i code to execute this program?
write a program in c++ to scramble a bmp image file using a scramble key 0x7c and an XOR logic. print out the original image, the scrambled image and the program. Note: the first 24bytes of a bmp file contain the header information of the file.
how to find out the maximum number out of the three inputs.
6 Answers ABC, Apple, C3I, HP, TCS,
Hello, I am trying to write a program in c++ which accepts month and year from the user and prints the calender. So please tell me the algorithm and what is the calender logic.
how to take time as input in the format (12:02:13) from user so that controls remains between these columns?
A string of charaters were given. Find the highest occurance of a character and display that character. eg.: INPUT: AEGBCNAVNEETGUPTAEDAGPE OUTPUT: E
An array of size 5X5 is given to us. The elements from 1 to 25 are to be inserted in the array, such that starting from a particular position for an element i, the next element i+1can be inserted only at the mentioned positions (u,v), and if these all positions are occupied then it returns giving a count of how many positions have been occupied in the array: (u,v) = (x+/-3 , y) (u,v) = (x , y+/-3) (u,v) = (x+/-2 , y+/-2). Example: if the starting element is 1 with the given positions (1,2), then next element 2 can be placed at any one of the positions marked with *. _ _ _ _ _ 1 _ _ _ * _ _ _ _ _ _ _ * _ _ * _ _ _ _
can you please write a program for deadlock that can detect deadlock and to prevent deadlock.
Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++
write a program to calculate the radius for a quadratic equation use modular programming(function abitraction)hint use quadratic function
1 Answers ICAN, Jomo Kenyatta University,
How can I Draw an ellipse in 3d space and color it by using graph3d?
swap prog