Function referring to abstract class
Afficher commentaires plus anciens
Hi
I'm looking to use an abstract class to represent a generic "interface" (texture) on a solar cell surface.
A "cell" object is made up of "layers" which each have a top and bottom interface:
classdef ct_layer < handle
properties
t; % layer thickness
n; % real refractive index
k; % imaj refractive index
interfaceT = ct_interface.empty % Top and Bottom interface
interfaceB = ct_interface.empty
where I want ct_interface to be the abstract class, so that I can go and make plannar interfaces or pyramidal interfaces or whatever later. I want to do it like this because not every layer needs to have an interface assigned -- it might just pick up those from adjacent layers when the cell is "assembled"
However I can't preset the "type" of interface if ct_interface is abstract, and it defaults to double[] otherwise (such that I can't add the interfaces when the time comes).
I've tried reading through all the docs without resolution, but I get the sense I'm thinking about this incorrectly.
Cheers in advance for any suggestions
Leon
Réponse acceptée
Plus de réponses (1)
Daniel Shub
le 16 Mar 2012
1 vote
I think the key piece is:
not every layer needs to have an interface assigned -- it might just pick up those from adjacent layers when the cell is "assembled"
I think you need to define a concrete class of ct_interface_none which is a subclass of the abstract ct_interface. The ct_interface_none class would then take care of picking up the information from the adjacent layers and deal gracefully with being in isolation..
Catégories
En savoir plus sur Image Preview and Device Configuration dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!