S
SC Shin
Hi, everyone
I've got problem.
I am able to compile following code without error on Compaq, Linux machine
But I am not able to compile this with error on Sun with forte7 compiler:
line 26: Unexpected type name: Apple
Please carefully review following code
And Let me know what problem is and how to solve this problem
1 class Apple
2 {
3 public:
4 static int load();
5 };
6
7 class Banana
8 {
9 public:
10 template<typename EL>
11 void load()
12 {
13 m_banana = EL::load();
14 }
15
16 private:
17 int m_banana;
18 };
19
20 class Peach
21 {
22 public:
23 static void initialize()
24 {
25 m_this = new Peach();
26 m_this->o_banana.load<Apple>();
27 }
28 static Peach* m_this;
29
30 private:
31 Banana o_banana;
32 };
33
34 Peach* Peach::m_this;
35
36 int main()
37 {
38 return 0;
39 }
I've got problem.
I am able to compile following code without error on Compaq, Linux machine
But I am not able to compile this with error on Sun with forte7 compiler:
line 26: Unexpected type name: Apple
Please carefully review following code
And Let me know what problem is and how to solve this problem
1 class Apple
2 {
3 public:
4 static int load();
5 };
6
7 class Banana
8 {
9 public:
10 template<typename EL>
11 void load()
12 {
13 m_banana = EL::load();
14 }
15
16 private:
17 int m_banana;
18 };
19
20 class Peach
21 {
22 public:
23 static void initialize()
24 {
25 m_this = new Peach();
26 m_this->o_banana.load<Apple>();
27 }
28 static Peach* m_this;
29
30 private:
31 Banana o_banana;
32 };
33
34 Peach* Peach::m_this;
35
36 int main()
37 {
38 return 0;
39 }