Article View: comp.sys.mac.programmer.help
Article #2C++ - How to alter non-static, private array with a private member function?
From: Jeffery R. Price
Date: Thu, 02 Nov 1995 23:15
Date: Thu, 02 Nov 1995 23:15
17 lines
1130 bytes
1130 bytes
I am using CW7 and am relatively new to C++. I have a class which has a private data member declared as: int Reg[6]; I have a private member function which I want to change the contents of Reg[6]. If I do not declare Reg[6] as static, CW7 gives me errors anywhere I try to alter Reg[i] in my member function - saying "Illegal use of a non-static data member". If I declare Reg[6] as static int Reg[6] (which I do not really want to do), I get linker errors saying that "myClass::Reg" is undefined in "myClass.cp" (the source for the class). It seems odd that I can alter any non-static data members that aren't arrays. I will certainly appreciate any help, Jeff Price
Technical Details
Message-ID:
<price-0211951815560001@price.mindspring.com>Path:
arc1-ca.pugleaf.net!price.mindspring.com!userShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!price.mindspring.com!user From: price@mindspring.com (Jeffery R. Price) Newsgroups: comp.sys.mac.programmer.help,comp.sys.mac.programmer.codewarrior,comp.lang.c++ Subject: C++ - How to alter non-static, private array with a private member function? Date: Thu, 02 Nov 1995 18:15:56 -0500 Organization: MindSpring Enterprises Message-ID: <price-0211951815560001@price.mindspring.com> NNTP-Posting-Host: price.mindspring.com