New Posts  All Forums:Forum Nav:

Help with parameter - Page 2

post #11 of 17
Thread Starter 
same error..
   
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
  hide details  
Reply
   
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
  hide details  
Reply
post #12 of 17
firstly this
Code:
void Benefit::benefit(string health, double life, int vaca)
{
health = healthInsurance;
life = lifeInsurance;
vaca = vacation;
}

should be this
Code:
void Benefit::benefit(string health, double life, int vaca)
{
healthInsurance = health;
lifeInsurance = life;
vacation = vaca;
}
otherwise you aren't actually setting anything

also this
Code:
void benefit();
void benefit(string health, double life, int vacation);

should be
Code:
void Benefit();
void Benefit(string health, double life, int vacation);

you have your class Benefit but your constructors as benefit
Edited by selectstriker2 - 1/31/12 at 10:17am
ShadowForge
(12 items)
 
Defiant
(14 items)
 
CarbonCat
(13 items)
 
CPUMotherboardGraphicsRAM
Phenom II x6 1405T (unlocked Athlon II X4 640T) ASUS M5A99X EVO AM3+ Asus ENGTX470/2DI/1280MD5/V2 16 GB (4x4GB) G.Skill DDR3 1600 CAS9 1.35v 
Hard DriveHard DriveOptical DriveCooling
WD Caviar Blue 250 2.5" Laptop Drive WD Caviar Black 1TB 3.5" Pioneer BDR-203 BluRay Burner Corsair H60 push 
OSOSMonitorPower
Windows 7 Pro x64 Ubuntu 11.10 Samsung 40" 60hz  ANTEC NEO ECO 520W 
CaseMouse
NZXT Gamma Microsoft Bluetooth Notebook Mouse 5000 
CPUMotherboardGraphicsRAM
i7 - 2600k [5.0 1.42v] ASUS P8Z68 Deluxe Sapphire HD6950 2gb Dirt 3 Edition 8GB G.Skill DDR3 2133 CAS11 
Hard DriveOSMonitorKeyboard
60GB G.Skill Sniper + 2x1TB Spinpoint F3 Raid0 Win 7 Pro x64 ASUS VW266H Razer Blackwidow 
PowerCaseMouse
Seasonic X750 Gold Corsair Carbide 500R White G9 
  hide details  
Reply
ShadowForge
(12 items)
 
Defiant
(14 items)
 
CarbonCat
(13 items)
 
CPUMotherboardGraphicsRAM
Phenom II x6 1405T (unlocked Athlon II X4 640T) ASUS M5A99X EVO AM3+ Asus ENGTX470/2DI/1280MD5/V2 16 GB (4x4GB) G.Skill DDR3 1600 CAS9 1.35v 
Hard DriveHard DriveOptical DriveCooling
WD Caviar Blue 250 2.5" Laptop Drive WD Caviar Black 1TB 3.5" Pioneer BDR-203 BluRay Burner Corsair H60 push 
OSOSMonitorPower
Windows 7 Pro x64 Ubuntu 11.10 Samsung 40" 60hz  ANTEC NEO ECO 520W 
CaseMouse
NZXT Gamma Microsoft Bluetooth Notebook Mouse 5000 
CPUMotherboardGraphicsRAM
i7 - 2600k [5.0 1.42v] ASUS P8Z68 Deluxe Sapphire HD6950 2gb Dirt 3 Edition 8GB G.Skill DDR3 2133 CAS11 
Hard DriveOSMonitorKeyboard
60GB G.Skill Sniper + 2x1TB Spinpoint F3 Raid0 Win 7 Pro x64 ASUS VW266H Razer Blackwidow 
PowerCaseMouse
Seasonic X750 Gold Corsair Carbide 500R White G9 
  hide details  
Reply
post #13 of 17
In the header, remove void from the constructor declaration.
^3
(11 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 5930K  EVGA x99 Micro EVGA GTX 980 SC ACX 16GB Corsair DDR4 Vengeance LPX Black PC4-21300 
Hard DriveCoolingOSMonitor
500GB Samsung 840 EVO H105 Win 10 ASUS ROG PG279 
KeyboardPowerCase
Ducky Shine 1 MX-Red Corsair AX 860i  Fractal Design Node 804 Black 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
^3
(11 items)
 
   
CPUMotherboardGraphicsRAM
Intel Core i7 5930K  EVGA x99 Micro EVGA GTX 980 SC ACX 16GB Corsair DDR4 Vengeance LPX Black PC4-21300 
Hard DriveCoolingOSMonitor
500GB Samsung 840 EVO H105 Win 10 ASUS ROG PG279 
KeyboardPowerCase
Ducky Shine 1 MX-Red Corsair AX 860i  Fractal Design Node 804 Black 
CPUGraphicsRAMHard Drive
Core i7 @ 2.6  GT650 16GB of 1600 MHz DDR3L SDRAM 256GB SSD 
OSMonitorKeyboard
Mac OSX Lion Retina Display US layout 
  hide details  
Reply
post #14 of 17
Thread Starter 
Quote:
Originally Posted by selectstriker2 View Post

firstly this
Code:
void Benefit::benefit(string health, double life, int vaca)
{
health = healthInsurance;
life = lifeInsurance;
vaca = vacation;
}
should be this
Code:
void Benefit::benefit(string health, double life, int vaca)
{
healthInsurance = health;
lifeInsurance = life;
vacation = vaca;
}
otherwise you aren't actually setting anything

did this, but I still got the error for the 1st one.
   
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
  hide details  
Reply
   
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
  hide details  
Reply
post #15 of 17
Thread Starter 
Quote:
Originally Posted by andrewmchugh View Post

In the header, remove void from the constructor declaration.

didn't work out, getting more errors if I do that.
   
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
  hide details  
Reply
   
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
  hide details  
Reply
post #16 of 17
Thread Starter 
Quote:
Originally Posted by selectstriker2 View Post

Code:
void benefit();
void benefit(string health, double life, int vacation);
should be
Code:
void Benefit();
void Benefit(string health, double life, int vacation);
you have your class Benefit but your constructors as benefit

sorry, but this gives me an error
Quote:
error C2380: type(s) preceding 'Benefit' (constructor with return type, or illegal redefinition of current class-name?)
   
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
  hide details  
Reply
   
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
CPUMotherboardGraphicsGraphics
Intel 4770K Asus ROG Maximus Formula VI EVGA GTX 980 SC EVGA GTX 980 SC 
RAMHard DriveHard DriveHard Drive
Corsair Vengenace PRO Western Digital Seagate Samsung 830 SSD 
Hard DriveCoolingOSMonitor
Plextor M5S SSD Aqua-Computer Windows 7 Ultiamte Asus ROG Swift PG278Q 
MonitorKeyboardPowerCase
Asus VS247H-P CoolerMaster QuickFire Pro CoolerMaster V850 CoolerMaster Storm Troope(Modified) 
MouseMouse PadAudioAudio
Razer Mamba Razer Vespula Bose Acoustimass 5.1 Setup Astro A40 
  hide details  
Reply
post #17 of 17
Your problem is that you're trying to declare a constructor with a return type. Constructors do not return anything, since they simply construct the class, thus your two constructors for Benefit need to look like so:
Code:
Benefit();
Benefit(string health, double life, int vacation);

It was all in the error message above (types preceding 'Benefit') and has also been said to you in this post.
Quote:
didn't work out, getting more errors if I do that.

What extra errors do you get?

Constructors definitely should not have a return type. No void, int, float, nothing.

Furthermore:
Code:
Benefit benefit1("adam", '2', '2');

Should be:
Code:
Benefit benefit1("adam", 2, 2);

The reason for the 'extra errors' you describe (I am taking a guess here as you did not post the exact errors you were getting) is that you may need to allocate memory to the instance of Benefit. To do this:
Code:
Benefit benefit1 = new Benefit("adam", 2, 2);

Remember that when doing this, you will need to manage the memory yourself and get rid of it whenever you need to, otherwise memory leaks will occur. Read up on C++ Memory Management for a better insight into how that works.

Also, for future reference, please post your code in code tags, using [ code ] and [ / code ] (without the spaces). Makes it much easier to read.
Edited by jNSK - 1/31/12 at 11:13pm
Project 4
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 Lynnfield @ 4.4 GHz, 1.41v EVGA P55 SLi (132-LF-E655-KR) - A72 BIOS EVGA GeForce GTX 680 4GB G.Skill Ripjaws @ 9-9-9-24, 1.51V 
Hard DriveOptical DriveOSMonitor
80GB Intel X25-M SSD + 500GB WD + 2TB Samsung F3 Samsung Super Writemaster DVD+-R Windows 7 Ultimate Edition Samsung SyncMaster 2433 24" 
KeyboardPowerCaseMouse
Logitech G15 Corsair TX750 750W Corsair Obsidian 800D + Scythe Kaze Master Ace Razer Deathadder Respawn - Black 
Mouse Pad
Steelseries QcK Medium - Black 
  hide details  
Reply
Project 4
(13 items)
 
  
CPUMotherboardGraphicsRAM
i5 750 Lynnfield @ 4.4 GHz, 1.41v EVGA P55 SLi (132-LF-E655-KR) - A72 BIOS EVGA GeForce GTX 680 4GB G.Skill Ripjaws @ 9-9-9-24, 1.51V 
Hard DriveOptical DriveOSMonitor
80GB Intel X25-M SSD + 500GB WD + 2TB Samsung F3 Samsung Super Writemaster DVD+-R Windows 7 Ultimate Edition Samsung SyncMaster 2433 24" 
KeyboardPowerCaseMouse
Logitech G15 Corsair TX750 750W Corsair Obsidian 800D + Scythe Kaze Master Ace Razer Deathadder Respawn - Black 
Mouse Pad
Steelseries QcK Medium - Black 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming