home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!news!iat.holonet.net!agate!doc.ic.ac.uk!uknet!mcsun!sun4nl!media03!pkr
- From: pkr@media03.UUCP (Peter Kriens)
- Newsgroups: comp.lang.c++
- Subject: stupid bug with NIHCL & sun ompiler
- Message-ID: <2895@media03.UUCP>
- Date: 9 Nov 92 21:12:55 GMT
- Organization: Mediasystemen, Netherlands
- Lines: 28
- X-Newsreader: Tin 1.1 PL4
-
-
- I am looking for people who could help me on the
- following puzzling problem:
-
- class A {
- public:
- String s;
- [virtual] void t();
- };
-
- main()
- {
- A a,b;
- a.s="abc";
- b.s="def";
- a = b;
- }
-
- without the virtual, no problem C++ uses the = operator for
- s from the String class and a new pointer is created.
-
- with the virtual operator, it uses a bit wise assignment
- and a.s will now point to the same memory location
- as b.s. Problems!
-
- Anybody knows something about this?
-
- Peter Kriens
-