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 13017
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: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: linyimin |
last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
|
by: erikbower65 |
last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA:
1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |