home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!ut-emx!jamshid
- From: jamshid@ut-emx.uucp (Jamshid Afshar)
- Newsgroups: comp.lang.c++
- Subject: Re: base classes and typedef not working?
- Summary: it's a bug: BC++ doesn't allow typedef in member init. list
- Message-ID: <83992@ut-emx.uucp>
- Date: 19 Nov 92 21:41:32 GMT
- References: <1992Nov14.190608.28656@muddcs.claremont.edu>
- Reply-To: jamshid@emx.utexas.edu
- Organization: The University of Texas at Austin; Austin, Texas
- Lines: 39
-
- In article <1992Nov14.190608.28656@muddcs.claremont.edu> dfoster@jarthur.claremont.edu (Derek R. Foster) writes:
- >In BC++ 3.1 the following code produces the error
- >"MatrixBase is not a base class of Matrix"
- >
- >typedef Array2<Scalar> MatrixBase;
- >
- >class Matrix : public MatrixBase
- >{
- > Matrix(int row, int col) : MatrixBase(row,col) {}; // error occurs here
- >};
-
- Actually, this bug shows up whether or not you're using templates
- (though there are other typedef bugs specific to templates). A
- constructor's member initialization list appears to be the only place
- BC++ 3.1 has problems using a typedef instead of the actual class
- name. I've already reported this to bugs@borland.com (no reply or
- tech. support). Just put the actual class name in for now, maybe
- marking it with a comment so you can fix it later. If you'd like a
- copy of my bug reports (mostly template related), just email me.
-
- class Base {
- public:
- virtual void f();
- };
-
- typedef Base B;
-
- class Derived : public B {
- public:
- Derived()
- : B() {} // BC++ error, but legal code. Use "Base()" for now.
- virtual void f() {
- B::f(); // okay, no complaints from BC++
- //...
- }
- };
-
- Jamshid Afshar
- jamshid@emx.utexas.edu
-