[comp.lang.c++] inheriting casts and assignments

dsa@dlogics.UUCP (David Angulo) (11/17/89)

// I have a question.  When I compile the following code in Glockenspiel's
//   c++ v 1.2 E on the VAX under VMS 5.2:

#include <stream.hxx>

class a
	{
	int pdq;
    public:
	a () {pdq = 1;}
	void operator=(const a& source_a) {pdq=source_a.pdq+1;}
	int operator int() {return pdq;}
	};

class b : public a
	{
    public:
	b() : () {}
	};


main ()
	{
	b a_b;
	a an_a;
	a_b = an_a;
	int c = (int)a_b;
	}

// I get the following error messages:
//    designer C Preprocessor, release 1.2 E
//    AT&T C++ Compiler, release 1.2 E
//    Copyright 1984  AT&T Inc. and 1986 through 1988  Glockenspiel Ltd.
//"sys$library:stddef.h", line 12: warning: " volatile" not implemented (ignored)
//"q3.cxx", line 26: error: assignment not defined for class b
//"q3.cxx", line 27: error: cannot cast class object to int
//
// I don't understand any of these error messages - shouldn't these methods
//   have been inherited from class a?
-- 
David S. Angulo                  (312) 266-3134
Datalogics                       Internet: dsa@dlogics.UUCP
441 W. Huron                     UUCP: ..!uunet!dlogics!dsa
Chicago, Il. 60610               FAX: (312) 266-4473