|
[Sponsors] |
July 12, 2010, 11:30 |
Variables inside classes
|
#1 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 15 |
Hi all,
I'm creating a class but I cannot declare variables inside my class to then use them in my member functions. Here is the error I get. const scalar pi2=3.14; error: ISO C++ forbids initialization of member âpi2â error: making âpi2â static |
|
July 13, 2010, 02:27 |
|
#2 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40 |
Quote:
Code:
static const scalar pi2 = 3.14; BTW: if you really just need PI, you could also consider using the constants provided with OpenFOAM: http://foam.sourceforge.net/doc/Doxy...stants_8H.html |
||
July 13, 2010, 13:16 |
|
#3 |
Member
Tony
Join Date: Jun 2010
Posts: 54
Rep Power: 15 |
That worked just fine. Thanks!
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenFOAM on MinGW crosscompiler hosted on Linux | allenzhao | OpenFOAM Installation | 127 | January 30, 2009 19:08 |
Modelling the Heat flow inside the curing oven | Marios Vlad | CFX | 1 | February 6, 2008 07:11 |
meshing F1 front wing | Steve | FLUENT | 0 | April 17, 2003 12:37 |
PHI file structure | Eugene | Phoenics | 9 | November 2, 2001 22:00 |
Parallel Computing Classes at San Diego Supercomputer Center Jan. 20-22 | Amitava Majumdar | Main CFD Forum | 0 | January 5, 1999 12:00 |