[comp.lang.c++] Typo in book by Keith Gorlen, et. al. ?

chetan@wizard.DSG.Tandem.COM (Chetan Saiya) (10/12/90)

Hi:
On page 146 (chpt. 8: Programming with the NIH Container Classes) of the book
Data Abstraction And Object Oriented Programming in C++, an example is given
for the "isKindOf()" function as follows :

Point p(0,1);
if (p.isKindOf(*Point::desc()))  .... YES
if (p.isKindOf(*Object::desc())) ....  NO
...

Shouldn't the last line say YES (or return TRUE), since Point is derived
from Object ?

Thanks,
Chetan

kgorlen@sparkler.dcrt.nih.gov (Keith Gorlen) (10/12/90)

In article <1990Oct11.175238.24917@tandem.com>,
chetan@wizard.DSG.Tandem.COM (Chetan Saiya) writes:
|>
|>Hi:
|>On page 146 (chpt. 8: Programming with the NIH Container Classes) of the book
|>Data Abstraction And Object Oriented Programming in C++, an example is given
|>for the "isKindOf()" function as follows :
|>
|>Point p(0,1);
|>if (p.isKindOf(*Point::desc()))  .... YES
|>if (p.isKindOf(*Object::desc())) ....  NO
|>...
|>
|>Shouldn't the last line say YES (or return TRUE), since Point is derived
|>from Object ?
|>
|>Thanks,
|>Chetan
 
You are correct, the comment is wrong.  It should read:

	if (p.isKindOf(*Object::desc()))  ...	// YES

Thanks for pointing this out.
               
	Keith Gorlen			phone: (301) 496-1111
	Building 12A, Room 2033		uucp: uunet!nih-csl!kgorlen
	National Institutes of Health	Internet: kgorlen@alw.nih.gov
	Bethesda, MD 20892