help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: same function name in two files


From: Ben Abbott
Subject: Re: same function name in two files
Date: Sun, 15 Jun 2014 20:27:44 -0400

On Jun 15, 2014, at 8:06 PM, kamaraju kusumanchi <address@hidden> wrote:

> Let's say I have two scripts (fileA.m, fileB.m) with the following set of 
> functions.
> 
> fileA.m
> foo()
> funcA1()
> funcA2()
> 
> fileB.m
> foo()
> funcB1()
> funcB2()
> 
> The implementation of foo() in both files is completely different. I have no 
> write permissions to edit fileA.m, fileB.m
> 
> A third script (fileC.m) uses all the six functions. I want to call both 
> foo() implementations at different points in the code. Is there any way to 
> achieve that? For example, is there anything like fileA.foo() , fileB.foo() 
> to distinguish between the two?
> 

I assume fileA.m and fileB.m are scripts and not functions?

Then, first run fileA and when you use foo() it corresponds to the 
implementation in fileA.

        fileA
        foo

To use the version if fileB, first fun fileB

        fileA
        foo

Ben



reply via email to

[Prev in Thread] Current Thread [Next in Thread]