Packaging Code and User-Defined Classes

2 views (last 30 days)
Ryan
Ryan on 20 Nov 2013
Commented: per isakson on 20 Nov 2013
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?

Answers (0)

Categories

Find more on Construct and Work with Object Arrays in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!