🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by P{r Emanuelsson Thu, 27 Jul 1989 17:39
virtual strangeness
#300
Author: P{r Emanuelsson
Date: Thu, 27 Jul 1989 17:39
34 lines
1102 bytes
What about this?

class base {
  public:
  char *data;
  virtual void operator=(const base& in) {
    printf("NYI!\n");
  }
};

class derived : public base {
  public:
  void operator=(base& in) {
    data = in.data;
  }
};

main()
{
  base *e = new derived;
  base *m = new derived;

  *e = *m;
}

With cfront 1.2 this works as (I) expected. With G++ it prints "NYI!".
Why is this? Neither compiler complains about anything.

Machine: Sun386i
--
"Don't think; let the machine do it for you!"
                                   -- E. C. Berkeley
Dept. of Electrical Engineering	                         pell@isy.liu.se
University of Linkoping, Sweden	                    ...!uunet!isy.liu.se!pell
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads