我是C++新手,我的問題可能很簡單,但我無法找到解決方案。 我有兩個班,S和L。 S看起來是這樣的: class S
{
private:
int m_x;
public:
S(int x) : m_x(x)
{
}
int m_y = 2*m_x; // some random action in S
};
現在我有一個第二類L,
我可以很容易地聲明並在頭文件中,像這樣初始化一個恆定陣列成員: class MyClass {
public:
const int arr[4] = {1, 2, 3, 4};
}
但是,當該數據由功能定義,我不能在報頭中初始化: #include <cmath>
#define BASE 2
class MyClass {
public:
const int a
FatalErrorException 無法在寫入上下文中使用函數返回值。這是一些語法問題還是什麼? $result1 = Some query here
$result2 = Some query here
$result3 = Some query here
//error start here
session('sessionVariable1')