Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pacbell!tandem!wizard!john From: john@wizard.UUCP (John Danner) Newsgroups: comp.lang.c++ Subject: private to a class or to an object? Message-ID: <517@wizard.UUCP> Date: 14 Sep 89 20:39:15 GMT Lines: 44 Why is the following piece of code acceptable to cfront 1.2? class flug { private: void printit() { printf("xy are %d %d\n",x,y); } int x,y; public: flug* z; flug() { }; void setxy(int a, int b) { x = a; y = b; } void printz() { z->printit();//no syntax error z->x = 6;//no syntax error z->y = 7;//no syntax error z->printit(); } }; main() { flug a,b; a.z = &b; b.setxy(1,0); a.printz(); // printf("a.z->x = %s, a.z->y = %s\n",a.z->x,a.z->y);//syntax error private } Shouldn't private data be private to a single object and not accessible to any object of that class? Is this something that is safe to take advantage of as far as compatibility with future versions of cfront? John Danner Tandem Computers, Inc. Net: pacbell!tandem!wizard!john@decwrl.dec.com UUCP:...!decwrl!pacbell!tandem!wizard!john