I have the following class, the primary-expression error takes place in the constructor before "{" token where the maskval[16] array gets initialized.
any help would be appreciated
emp1953 -
class encoderclass
-
{
-
public:
-
-
//vars
-
long maskval[16];
-
float bitval[15];
-
-
//methods
-
short encodeCosineData(float);
-
float decodeCosineData(int);
-
encoderclass()
-
{
-
maskval[16]= {1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768};
-
-
bitval[15] = {(1/16000),
-
(1/8000),
-
(1/4000),
-
(1/2000),
-
(1/1000),
-
(1/512),
-
(1/256),
-
(1/128),
-
(1/64),
-
(1/32),
-
(1/16),
-
(1/8),
-
(1/4),
-
(1/2),
-
1 };
-
};
-
-
-
private:
-
-
protected:
-
-
};
2 13046
You have to remember that constructors do not construct objects. The compiler constructs the objects by allocating memory and intializing all of the data members and then calls your constructor so you can finish up any details not already completed.
The arrays you are initializing in the constructor already exist so you cannot use array initilization syntax on them. You will need change the value of each element explicitly.
You have to remember that constructors do not construct objects. The compiler constructs the objects by allocating memory and intializing all of the data members and then calls your constructor so you can finish up any details not already completed.
The arrays you are initializing in the constructor already exist so you cannot use array initilization syntax on them. You will need change the value of each element explicitly.
Understood, and that's the fix, thanks a bunch
emp
Sign in to post your reply or Sign up for a free account.
Similar topics
by: andy.herrera |
last post by:
I'm getting this Error Message. Expected ';'
Please Select One:
<form name="form1"> <<------------ Error is here.
<select name="selectTrans" onChange="If (this.value == 'checkout')...
|
by: Tony Wilkinson |
last post by:
Hi,
As a complete novice to C# I have fallen at the first hurdle. Sad but
true, I can't get 'Hello World' to work!
I have downloaded the .net SDK etc and installed them on my
workstation as...
|
by: Tony Tone |
last post by:
I am having trouble resolving this issue:
Server Error in '/test' Application.
--------------------------------------------------------------------------------
Compilation Error
Description:...
|
by: ee02iu |
last post by:
a = 0; a = 0; a = 0; a = 0;
are the results from the printf() in the following program using an old Borland C++ (V4.5) compiler.
#include <stdio.h>
int a = {0, 1, 2, 3, 4};
int main( ) {...
|
by: Jeff |
last post by:
Im compiling code on Fedora and I get the following error:
202: error: expected `;' before 'itr'
this is in a .h file which has no .cpp file:
template < typename Tcharl, typename Tcharr >...
|
by: =?Utf-8?B?UElFQkFMRA==?= |
last post by:
I'd really like to be able to constrain a generic type to System.Enum or,
better, enum. But of course that results in "Compiler Error CS0702".
So far I've been checking the type parameter at...
|
by: Peted |
last post by:
Hi,
im moving a project from vs2005 to vs 2008.
is doing so i have come across a compiler error regarding partial
classes that i dont understand if anyone can explain it to me please
the...
|
by: Shaheen Kushan |
last post by:
I desperately need help with this error,
Compilation Error:
Compiler Error Message: CS1002: ; expected
Source Error:
Line 71:...
|
by: Anu ms |
last post by:
Whenever i am trying yo compile , getting the error as
Compilation Error: Compiler Error Message: CS1002: ; expected
but i am not able to locate the error in the code.
Thank you in Advance...
|
by: rameshjumgam |
last post by:
i am having in my code like
std::list<T*>::const_iterator iter=lst.begin();
and i am getting error
error: expected `;' before âiterâ
/root/INCLUDE/cw/gdlist.h:140: error: âiterâ was...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |