Include a file: Difference between revisions

Content added Content deleted
m (→‎{{header|Vala}}: remove blank lines)
m (remove more blank lines)
Line 395: Line 395:


Just this would be enough.
Just this would be enough.
<lang Java>
<lang Java>public class Class1 extends Class2
public class Class1 extends Class2
{
{
//code here
//code here
}</lang>
}
</lang>


You could also consider creating an instance of Class2 within Class1, and then using the instance methods.
You could also consider creating an instance of Class2 within Class1, and then using the instance methods.
<lang Java>
<lang Java>public class Class1
public class Class1
{
{
Class2 c2=new Class2();
Class2 c2=new Class2();
Line 412: Line 409:
c2.func2();
c2.func2();
}
}
}</lang>
}
</lang>


=={{header|JavaScript}}==
=={{header|JavaScript}}==
Line 488: Line 484:
New functions can be included, either by storing a new function in an existing path, or by extending the existing path to a new directory. When two functions have the same name, the function found first in the path takes precedence. The later is shown here:
New functions can be included, either by storing a new function in an existing path, or by extending the existing path to a new directory. When two functions have the same name, the function found first in the path takes precedence. The later is shown here:


<lang MATLAB>
<lang MATLAB> % add a new directory at the end of the path
% add a new directory at the end of the path
path(path,newdir);
path(path,newdir);
addpath(newdir,'-end'); % same as before
addpath(newdir,'-end'); % same as before
Line 495: Line 490:
% add a new directory at the beginning
% add a new directory at the beginning
addpath(newdir);
addpath(newdir);
path(newdir,path); % same as before
path(newdir,path); % same as before</lang>
</lang>


=={{header|Maxima}}==
=={{header|Maxima}}==