Packaging Code and User-Defined Classes

조회 수: 2 (최근 30일)
Ryan
Ryan 2013년 11월 20일
댓글: per isakson 2013년 11월 20일
I'm new to OOP in Matlab, so I apologize in advance if I get my terms a little backwards.
I work in an environment where we share data on a daily basis. The idea that this data could be stored in a user-defined class that would control behavior and limit/protect end-user interaction is very appealing. Is it possible to encapsulate both data and the code necessary interact with that data in a single file?
For example, say I have variable varA , which represents an object created from my user-defined class. I can use varA without any problems on my machine because I wrote the code that governs its behavior. Now, I want to send varA to my colleague, who does not have the classdef file. Is it possible to make varA such that it carries the code necessary for my colleague to interact with it? In other words, is it possible to avoid distributing the functions that define the class any time someone needs to use the object?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by