フィルターのクリア

Can I make my game code and object classes into one .m file.

1 回表示 (過去 30 日間)
Tim
Tim 2022 年 12 月 8 日
回答済み: Matthew 2022 年 12 月 9 日
For my class project I have to hand in one MATLAB script(.m)file. Right now I have three .m files: AirHockey.m(this has all the game code), Puck.m(object class that has the properties and constructors for the puck), Blocker.m(object class that has the properies and constructors for the player controled blockers). How would I make these into one .m file and have the game still work.

採用された回答

Matthew
Matthew 2022 年 12 月 9 日
Unfortunately, only one class definition is allowed per file and it must come at the head of the file.
Without completely refactoring your code into a single class, you won't be able to cram it into a single m file (of course, without seeing the code we can't know how difficult that might be).

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStrategy & Logic についてさらに検索

タグ

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by