![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Aug 2007
Posts: 13
Rep Power: 0
![]() |
what happen when u run this code
helo one of my client give me this code and make comment on this. but i dont know whats going beyond this. code is given below
class Base {
public:
virtual void foo() = 0;
virtual void bar() = 0;
};
class Der1 : public virtual Base {
public:
virtual void foo();
};
void Der1::foo()
{ bar(); }
class Der2 : public virtual Base {
public:
virtual void bar();
};
class Join : public Der1, public Der2 {
public:
...
};
int main()
{
Join* p1 = new Join();
Der1* p2 = p1;
Base* p3 = p1;
p1->foo();
p2->foo();
p3->foo();
}Amit Last edited by big_k105; Sep 5th, 2007 at 10:52 AM. Reason: added Code tags |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Jan 2007
Location: Cape Town
Posts: 291
Rep Power: 2
![]() |
|
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Twelve posts, you should know to put your code in tags by now. Reread the "How to Post a Question" sticky.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Hobbyist Programmer
Join Date: Jan 2006
Location: UK
Posts: 215
Rep Power: 3
![]() |
I have a crazy idea. Why don't you build and run this code sample given to you for yourself and see what it does ? :O
|
|
|
|
|
|
#5 |
|
Professional Programmer
|
You might want to give some more information on your situation. For starters, if this is your client's code, what exactly are they paying you to do? Second, how do you not know what this does? Third, what kind of "comments" are you expected to provide? You need to be whole lot clearer if you expect to get help around here.
__________________
Amateurs built the ark Professionals built the Titanic |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EXECryptor software protection | Jean5 | C++ | 35 | Oct 10th, 2006 7:10 PM |
| Little help | whoawhoayoyo | Assembly | 8 | Apr 18th, 2006 7:10 PM |
| How to post a question | nnxion | C++ | 10 | Jun 3rd, 2005 11:53 AM |
| How to post a question | nnxion | C++ | 0 | Jun 3rd, 2005 8:55 AM |
| How to post a question | nnxion | C | 0 | Jun 3rd, 2005 8:55 AM |