TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Tristan Ball
from: David Nugent
date: 1995-08-13 16:10:00
subject: problem in c++

> > the program look likes this:

 > > struct unit {char ch;int i};

 > > class dim
 > > {
 > >   unit *x;
 > > };

 > > x=new unit[]={...};

 > I think you'll find that all elements of a class are by
 > defualt private, hence access to those elements by
 > functions outside the class will cause the compiler to
 > barf.

This is true, although in this case 'struct' was used - meaning that all
elements in a struct are by default public.  In any case, this isn't the
issue; the default constructor for this struct (aka class) will do nothing,
so it should work regardless.

I assume that the call to operator new occurs within a member function of
class dim (necessarily, there's no reference to an object there, so 'x'
would need to refer to the implicit 'this').

---
* Origin: Unique Computing, Melbourne, Australia (3:632/348)
SEEN-BY: 50/99 620/243 623/630 632/103 348 998 633/371 634/384 388 635/301
SEEN-BY: 502 503 544 727 636/100 639/100 711/401 409 410 430 510 807 808 809
SEEN-BY: 932 934 712/515 713/888 714/906 800/1 7877/2809
@PATH: 632/103 348 635/503 50/99 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.