Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   what happen when u run this code (http://www.programmingforums.org/showthread.php?t=13915)

amitpansuria Sep 5th, 2007 4:24 AM

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();
 }

plz tell me what comment i can make on this
Amit

rwm Sep 5th, 2007 4:36 AM

Quote:

Originally Posted by amitpansuria (Post 133327)
helo one of my client give me this code and make comment on this.Amit

You program for a living?

DaWei Sep 5th, 2007 5:17 AM

Twelve posts, you should know to put your code in tags by now. Reread the "How to Post a Question" sticky.

Seif Sep 5th, 2007 3:47 PM

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

peace_of_mind Sep 5th, 2007 4:10 PM

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.


All times are GMT -5. The time now is 2:54 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC