Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com List-Unsubscribe: List-Archive: List-Help: , Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Message-ID: <19990802205215.22723.qmail@hotmail.com> X-Originating-IP: [209.209.164.2] From: "Ward Correll" To: cygwin AT sourceware DOT cygnus DOT com Subject: Maybe a Bug in Cygwin in using Pointers to class fuctions Date: Mon, 02 Aug 1999 16:52:14 EDT Mime-Version: 1.0 Content-Type: text/plain; format=flowed Maybe a bug in Cygwin! I think that this sorce code is correct in the Final ANSI\ISO standard on C++ so I think it could be cygwin. Please check it out for me in this simple code. //Maybe a bug (in Cygwin) in using a pointer to a class fuction #include class Mammal { public: Mammal():itsAge(1) { } virtual ~Mammal() { } virtual void Speak() const = 0; virtual void Move() const = 0; protected: int itsAge; }; class Dog : public Mammal { public: void Speak()const { cout << "Woof!\n"; } void Move() const { cout << "Walking to heel...\n"; } }; class Cat : public Mammal { public: void Speak()const { cout << "Meow!\n"; } void Move() const { cout << "slinking...\n"; } }; class Horse : public Mammal { public: void Speak()const { cout << "Winnie!\n"; } void Move() const { cout << "Galloping...\n"; } }; int main() { void (Mammal::*pFunc)() const =0; Mammal* ptr =0; int Animal; int Method; bool fQuit = false; while (fQuit == false) { cout << "(0)Quit (1)dog (2)cat (3)horse: "; cin >> Animal; switch (Animal) { case 1: ptr = new Dog; break; case 2: ptr = new Cat; break; case 3: ptr = new Horse; break; default: fQuit = true; break; } if (fQuit) break; cout << "(1)Speak (2)Move: "; cin >> Method; switch (Method) { case 1: pFunc = Mammal::Speak; break; default: pFunc = Mammal::Move; break; } (ptr->*pFunc)(); delete ptr; } return 0; } =========================OUTPUT FROM CYGWIN========================== BASH.EXE-2.02$ c++ -o try try.cpp test.cpp: In function `int main()': test.cpp:66: assuming & on `Mammal::Speak' test.cpp:67: assuming & on `Mammal::Move' ===================================================================== I know I want the fuction pointer to assume on Mammal::Speak or Mammal::Move when meets some conditions as you see. But cygwin won't let me do that. Anyway to force compiling? Thanks!!! if you gave it a try. _______________________________________________________________ Get Free Email and Do More On The Web. Visit http://www.msn.com -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com