Info

此问题已关闭。 请重新打开它进行编辑或回答。

How can I make inheritance selectable?

1 次查看(过去 30 天)
Tom McGiffen
Tom McGiffen 2016-6-20
关闭: MATLAB Answer Bot 2021-8-20
I am doing some work in wireless. I wanted to select between Mac layer classes as such:
classdef myRadio < chosenMacLayer
where chosenMacLayer is a "variable" in that other code will swap it to the desired MAC layer. Can this be done?
Thanks! Tom

回答(1 个)

Walter Roberson
Walter Roberson 2016-6-20
I don't think so. I gather that the approach to use in a situation like this would be to declare a class with virtual methods, and then the various Mac Layer classes would inherit from it and be responsible for instantiating the methods that differ between the sorts of layers.

此问题已关闭。

产品

Community Treasure Hunt

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

Start Hunting!

Translated by