Dear Tamer,
I'm afraid that this is a bug in Ox: the base class B lives in namespace N (so
is called N::B), but when deriving in it, the namespace is wrongly ignored (so
it is looking for a class B in the global namespace rather than N::B.
I have fixed it, so it will be in the next version (7.1): your code should then
work as expected.
Then you'll be able to write:
1) class D : B
inside the namespace
2) class D : ::Database
inside the namespace to derive from Database (which is in the global namespace).
3) class D : N::B
outside the namespace (but note that references to the base class should not
have N::).
Nested namespaces are not allowed in Ox, so support is more limited than C++.
Best wishes, Jurgen
oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox
oxoxoxox 16th OxMetrics user conference 2015
oxoxoxox Cass Business School London, 3-4 September
oxoxoxox 2015 Econometrics Summer School
oxoxoxox TBC
oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox
Dr Jurgen A Doornik
James Martin Fellow, Institute for New Economic Thinking
at the Oxford Martin School, University of Oxford
http://www.doornik.com
http://www.oxmetrics.net
oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox
On 2014-08-05 10:22, Tamer Kulaksizoglu wrote:
> Dear All,
>
> Does anyone know how to inherit from a class inside a namespace? The following
> code is not working for some reason:
>
> #include <oxstd.oxh>
> namespace N {
> class B {
> B();
> ~B();
> }
> B::B() { }
> B::~B() { }
> class D : B {
> D();
> ~D();
> }
> D::D() { }
> D::~D() { }
> }
> main()
> {
> }
>
> But it works, as it should, when the namespace is removed. Any help is appreciated.
>
> Regards
> Tamer Kulaksizoglu
>
|