Topic: access declarations and using directives
Author: Dominique.Marcadet@supelec.fr (Dominique Marcadet)
Date: 1996/05/20 Raw View
Hello,
In namespace.udecl, there is the following example :
class A {
private:
void f(char);
public:
void f(int);
protected:
void g();
};
class B : public A {
using A::f; // error: A::f(char) is inaccessible
public:
using A::g; // B::g is a public synonym for A::g
};
Giving public access to member g in class B was forbidden in the ARM (when
using access declarations). Does this removed limitation is the one
mentionned in the following note (in class.access.dcl) ?
Access declarations are deprecated; member using-declarations
(_namespace.udecl_) provide a better means of doing the same things.
In earlier versions of the C++ language, access declarations were more
limited; they were generalized and made equivalent to using-
declarations in the interest of simplicity. Programmers are encour-
aged to use using, rather than the new capabilities of access declara-
tions, in new code.
+------------------------------------------------------------------------=
+
| Service Informatique Supelec | Dominique.Marcadet@supelec.fr =
|
| Plateau de Moulon | Tel : +33 1 69 85 14 73 =
|
| 91192 Gif sur Yvette Cedex - France | Fax : +33 1 69 85 12 34 =
|
---
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]
Author: Dominique Marcadet <Dominique.Marcadet@supelec.fr>
Date: Mon, 6 May 1996 12:00:28 +0200 Raw View
Hello,
In namespace.udecl, there is the following example :
class A {
private:
void f(char);
public:
void f(int);
protected:
void g();
};
class B : public A {
using A::f; // error: A::f(char) is inaccessible
public:
using A::g; // B::g is a public synonym for A::g
};
Giving public access to member g in class B was forbidden in the ARM (when
using access declarations). Does this removed limitation is the one
mentionned in the following note (in class.access.dcl) ?
Access declarations are deprecated; member using-declarations
(_namespace.udecl_) provide a better means of doing the same things.
In earlier versions of the C++ language, access declarations were more
limited; they were generalized and made equivalent to using-
declarations in the interest of simplicity. Programmers are encour-
aged to use using, rather than the new capabilities of access declara-
tions, in new code.
+--------------------------------------------------------------------------+
| Dominique Marcadet |
+--------------------------------------------------------------------------+
| Service Informatique Supelec | |
| Plateau de Moulon | Dominique.Marcadet@supelec.fr |
| 91192 Gif sur Yvette Cedex - France | |
| Tel : (33~1) 69 85 12 12 | Tel direct : (33~1) 69 85 14 73 |
| Fax : (33~1) 69 85 12 34 | |
+--------------------------------------------------------------------------+
[ comp.std.c++ is moderated. To submit articles: try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html ]
[ Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html ]
[ Comments? mailto:std-c++-request@ncar.ucar.edu ]