Thread: compiler error?

  1. #1
    Knot
    Guest

    compiler error?

    I cant figure why this won't work...I've done it before!
    Code:
    class A {
    public:
    void Do(A& a){}
    };
    
    class B : public A {
    public:
    };
    
    class C : public A {
    public:
    };
    
    int 
    main( void )
    {
     B b;
     C c;
     
     c.Do(b);  /* ERROR!*/
     b.Do(c);  /* ERROR!*/
    
     return 0;
    }
    -- am I missing something here??


    Code tags added by Hammer

  2. #2
    geek SilentStrike's Avatar
    Join Date
    Aug 2001
    Location
    NJ
    Posts
    1,141
    What are the compiler errors? That code compiled for me (g++ 3.2)
    Prove you can code in C++ or C# at TopCoder, referrer rrenaud
    Read my livejournal

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    The code compiled fine for me in Dev-C++

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    12
    Borland 5.01 compiles it ..

  5. #5
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    VC++ 6.0, works fine.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Making C DLL using MSVC++ 2005
    By chico1st in forum C Programming
    Replies: 26
    Last Post: 05-28-2008, 01:17 PM
  3. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  4. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  5. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM