Path: utzoo!attcan!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!rutgers!uwvax!oddjob!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c++ Subject: Re: Can we hide the private part of a class ? Keywords: header dependency, efficiency. Message-ID: <13862@mimsy.UUCP> Date: 4 Oct 88 19:27:30 GMT References: <1358@stratus* <1988Sep29.044111.16104@utzoo.uucp> <1375@cumulus> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 27 -In article <4223@polya.Stanford.EDU* shap@polya.Stanford.EDU -(Jonathan S. Shapiro) suggests that ->The fact that a programmer can willfully break the type system is not ->a good argument here. I can also use integer pointers as character ->pointers. If the function returning pointer wants to be type-safe, ->it should be declared as returning a pointer to a class member. In ->that case, what Henry says continues to be true. In article <1375@cumulus> hsu@cumulus (Yung-Kao Hsu) answers: -What I really should say in the previous posting is: the language should -provide some mechanisms (i.e, hiding the data type definition) that prevent -the programmer from mis-use even they want to. It cannot be done. If the programmer is curious enough, or desperate enough, he will physically disassemble the machine in order to make it do what he wants. I know, for I have done it. Far better than making it hard to do it wrong is making it easy to do it right. -Also, your example is not quite convincing, since character and integer -are not considered as "private" types but pre-defined public data types -and we all know how they are implemented. Except that many people who `know' this are in fact wrong. The analogy seems reasonably apt to me. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris