# This file is part of NIT ( http://www.nitlanguage.org ).
#
-# Copyright 2008 Jean Privat <jean@pryen.org>
-#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
import kernel
-class A
+import base_prot0
+
+redef class A
fun pub do 0.output
protected fun pro do 1.output
private fun pri do 2.output
a.pub
a.pro
a.pri
+ 3.output
end
init do end
end
--- /dev/null
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import kernel
+
+class A
+end
# This file is part of NIT ( http://www.nitlanguage.org ).
#
-# Copyright 2008 Jean Privat <jean@pryen.org>
-#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# See the License for the specific language governing permissions and
# limitations under the License.
+import base_prot0
private import base_prot
-class A2
+class B
super A
- fun o
- do
+ redef fun pub do 10.output
+ redef fun pro do 11.output
+ #alt1#redef fun pri do 12.output
+ fun o do
pub
pro
- #alt1#pri
+ #alt2#pri
end
- init do end
end
class O2
fun o
do
- var a = new A
+ var a = new B
a.pub
- #alt2#a.pro
- #alt3#a.pri
-
- var a2 = new A2
- a2.o
- a2.pub
- #alt4#a2.pro
- #alt5#a2.pri
+ #alt3#a.pro
+ #alt4#a.pri
+ 13.output
end
init do end
end
# This file is part of NIT ( http://www.nitlanguage.org ).
#
-# Copyright 2008 Jean Privat <jean@pryen.org>
-#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# See the License for the specific language governing permissions and
# limitations under the License.
+import base_prot0
private import base_prot2
-intrude import base_prot
+
+class C
+ super A
+ #alt5#redef fun pub do 20.output
+ #alt6#redef fun pro do 21.output
+ #alt1#redef fun pri do 22.output
+ fun o do
+ #alt7#pub
+ #alt8#pro
+ #alt2#pri
+ end
+end
class O3
fun o
do
- var a = new A
- a.pub
- a.pro
- a.pri
+ var a = new C
+ #alt9#a.pub
+ #alt3#a.pro
+ #alt4#a.pri
+ 23.output
end
init do end
end
(new O3).o
-
-alt/base_prot2_alt1.nit:25,3--5: Error: Method or variable 'pri' unknown in A2.
+alt/base_prot2_alt1.nit:22,12--14: Error: No property B::pri is inherited. Remove the redef keyword to define a new property.
-alt/base_prot2_alt2.nit:35,3--7: Error: Method 'pro' is protected and can only acceded by self. none
+alt/base_prot2_alt2.nit:26,3--5: Error: Method or variable 'pri' unknown in B.
-alt/base_prot2_alt3.nit:36,3--7: Error: Method 'pri' doesn't exists in A.
+alt/base_prot2_alt3.nit:35,3--7: Error: Method 'pro' is protected and can only acceded by self.
-alt/base_prot2_alt4.nit:41,3--8: Error: Method 'pro' is protected and can only acceded by self. none
+alt/base_prot2_alt4.nit:36,3--7: Error: Method 'pri' doesn't exists in B.
--- /dev/null
+alt/base_prot3_alt1.nit:22,12--14: Error: No property C::pri is inherited. Remove the redef keyword to define a new property.
--- /dev/null
+alt/base_prot3_alt2.nit:26,3--5: Error: Method or variable 'pri' unknown in C.
--- /dev/null
+alt/base_prot3_alt3.nit:35,3--7: Error: Method 'pro' doesn't exists in C.
--- /dev/null
+alt/base_prot3_alt4.nit:36,3--7: Error: Method 'pri' doesn't exists in C.
--- /dev/null
+alt/base_prot3_alt5.nit:20,12--14: Error: No property C::pub is inherited. Remove the redef keyword to define a new property.
--- /dev/null
+alt/base_prot3_alt6.nit:21,12--14: Error: No property C::pro is inherited. Remove the redef keyword to define a new property.
--- /dev/null
+alt/base_prot3_alt7.nit:24,3--5: Error: Method or variable 'pub' unknown in C.
--- /dev/null
+alt/base_prot3_alt8.nit:25,3--5: Error: Method or variable 'pro' unknown in C.
--- /dev/null
+alt/base_prot3_alt9.nit:34,3--7: Error: Method 'pub' doesn't exists in C.