Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: problem in calling show function in Object oriented
Date: Thu, 15 Oct 2009 01:08:03 +0000 (UTC)
Organization: Mohammad Ali Jinnah Univ
Lines: 68
Message-ID: <hb5slj$33i$1@fred.mathworks.com>
References: <hb5nb0$s06$1@fred.mathworks.com> <see-16B817.20104414102009@news.frontiernet.net>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1255568883 3186 172.30.248.37 (15 Oct 2009 01:08:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 15 Oct 2009 01:08:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 137999
Xref: news.mathworks.com comp.soft-sys.matlab:577387


Yes I found the error  this = point(x,y) but still same error ??? No appropriate method or public field show for class point. Now I think I am having problem calling class functions on object of the class. Kindly try to run the code and suggest me something to fix this problem. 
classdef point
    properties
        x
        y
    end
    methods
        function this= point(x,y)
            this.x=x;
            this.y=y;
        end
        function this.show()
            this.disp('something');
        end
        function this.xchange(var)
            this.x=var;
        end
    end
end

Doug Schwarz <see@sig.for.address.edu> wrote in message <see-16B817.20104414102009@news.frontiernet.net>...
> In article <hb5nb0$s06$1@fred.mathworks.com>,
>  "Syed " <cancer216@hotmail.com> wrote:
> 
> > classdef points
> >     properties
> >         x
> >         y
> >     end
> >     methods
> >         function pp= point(x,y)
> >             this.x=x;
> >             this.y=y;
> >         end
> >         function show()
> >             disp('hhehe');
> >         end
> >     end
> > end
> 
> 
> Try something like this:
> 
> 
> classdef points
>     properties
>         x
>         y
>     end
>     methods
>         function this = point(x,y)
>             this.x = x;
>             this.y = y;
>         end
>         function show(this)
>             disp('hhehe');
>         end
>     end
> end
> 
> 
> By comparing my code with your code it should be obvious what you did 
> wrong.
> 
> -- 
> Doug Schwarz
> dmschwarz&ieee,org
> Make obvious changes to get real email address.