Packaging Code and User-Defined Classes

2 visualizaciones (últimos 30 días)
Ryan
Ryan el 20 de Nov. de 2013
Comentada: per isakson el 20 de Nov. de 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?

Respuestas (0)

Categorías

Más información sobre Construct and Work with Object Arrays en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by