TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Griffon Chan
from: David Nugent
date: 1995-08-15 12:18:12
subject: Problem in C++

> I'm facing a difficult problem in create and initialize
 > an array of structure in Borland C++ 4.0. Hope there are
 > some smart guys can help me. :) It will be better if the
 > type of box[] is change to a pointer. :)

No, it can be an array. But unless it really needs to be part of every
class instance, why not simply make it 'static'?

struct cell {char ch;unsigned int attr:8;};

class frame
{
  static cell box[];

  public:
    frame();
};


 > Note that the sequence of initialize list has no pattern
 > and various length.

cell frame::box=
{
    {'u',0x1F},{'r',0x1F},{'a',0x1F},{'t',0x1F},{'i',0x1F},{'o',0x1F},
    {'n',0x1F},{' ',0x19},{'ú',0x19},{' ',0x19},{'ú',0x19},{' ',0x19},
    {' ',0x19},{'G',0x17},{'r',0x17},{'i',0x17},{'f',0x17},{'f',0x17},
    {'o',0x17},{'n',0x17},{' ',0x17},{'º',0x19},{'È',0x10},{'Í',0x19}
};

This is declared OUTSIDE any function at file scope.

---
* 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™.