From: "Savas Parastatidis" <Savas.Parastatidis@ncl.ac.uk>
To: <egcs@cygnus.com>
Subject: Pure virtual member and namespaces.
Date: Sat, 21 Mar 1998 10:36:00 -0000 [thread overview]
Message-ID: <000801bd5414$49e6e630$51d0f080@newyork.ncl.ac.uk> (raw)
Dear all,
I think there is a problem while compiling the following example using the
latest snapshot of egcs:
#include <iostream>
using namespace std;
namespace FooNamespace
{
class Foo
{
public:
Foo() {}
virtual void f() = NULL;
};
}
class MyClass : public FooNamespace::Foo
{
public:
MyClass() {};
void f() { cout << "Boom" << endl; }
};
void main()
{
MyClass* x = new MyClass;
FooNamespace::Foo* foo = x;
foo->f();
}
The message I get is:
/tmp/cca11232.s: Assembler messages:
/tmp/cca11232.s:257: Fatal error: Symbol __tfQ212FooNamespace3Foo already
defined.
Any ideas? Am I doing something wrong? Ah, the problem I talked about in a
previous message persists. I do not send this to comp.std.c++ as it is my
understanding that the following example complies with the standard. Please,
comment...
#include <map>
namespace X
{
class foo1
{
public:
int bar;
friend bool operator<(const foo1&, const foo1&);
};
}
bool operator<(const X::foo1& rhs, const X::foo1& lhs)
{
cout << "using this" << endl;
return (rhs.bar < lhs.bar);
}
namespace X
{
class foo2
{
public:
foo2()
{
MyMap m;
foo1 f1, f2;
m.insert(MyMap::value_type(f1, 1));
m.insert(MyMap::value_type(f2, 1));
}
private:
typedef std::map<foo1, int> MyMap;
};
}
int main()
{
X::foo2 f2;
}
Thank you very much,
--
Savas Parastatidis, PhD. Student, Claremont Bridge 353
Dept. of Computing Science, University of Newcastle, NE1 7RU, UK
e-mail: Savas.Parastatidis@ncl.ac.uk, tel. +44 191 222 8789
URL: http://www.ncl.ac.uk/~n5831124 , fax +44 191 222 8232
next reply other threads:[~1998-03-21 10:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-03-21 10:36 Savas Parastatidis [this message]
1998-03-24 0:03 ` Martin von Loewis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='000801bd5414$49e6e630$51d0f080@newyork.ncl.ac.uk' \
--to=savas.parastatidis@ncl.ac.uk \
--cc=egcs@cygnus.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).