汽车电子 - matlab - 用法

汽车电子 - matlab - 用法

面向对象

matlab 复制代码
% Man.m
classdef Man < handle
    %UNTITLED2 此处显示有关此类的摘要
    %   此处显示详细说明

    properties(Access=private) %私有变量
        score
    end
    properties
        age
        height
    end

    methods
        function obj = Man(inputArg1,inputArg2)
            %UNTITLED2 构造此类的实例
            %   此处显示详细说明
            obj.age = inputArg1 + inputArg2;
        end

        function outputArg = method1(obj,inputArg)
            %METHOD1 此处显示有关此方法的摘要
            %   此处显示详细说明
            outputArg = obj.age + inputArg;
        end

        function obj=grow(obj,inputArg)
           obj.age=obj.age+inputArg; 
        end
        
        function obj=setScore(obj,inputArg)
            obj.score=inputArg;
        end
        function score=getScore(obj)
            score=obj.score;
        end
    end
end
matlab 复制代码
% Person 继承自 Man
classdef Person < Man
    %PERSON 此处显示有关此类的摘要
    %   此处显示详细说明
    
    properties
        Property1
    end
    
    methods
        function obj = Person(inputArg1,inputArg2,inputArg3)
            %PERSON 构造此类的实例
            %   此处显示详细说明
            obj=obj@Man(inputArg1,inputArg2);

            obj.Property1 = inputArg3;
        end
        
        function outputArg = method1(obj,inputArg)
            %METHOD1 此处显示有关此方法的摘要
            %   此处显示详细说明
            outputArg = obj.Property1 + inputArg;
        end
    end
end
相关推荐
寻星探路1 小时前
Java EE初阶启程记13---JUC(java.util.concurrent) 的常见类
java·开发语言·java-ee
哲Zheᗜe༘1 小时前
了解学习Python编程之python基础
开发语言·python·学习
落日漫游2 小时前
数据结构笔试核心考点
java·开发语言·算法
寻找华年的锦瑟2 小时前
Qt-配置文件(INI/JSON/XML)
开发语言·qt
HY小海2 小时前
【C++】AVL树实现
开发语言·数据结构·c++
workflower2 小时前
Fundamentals of Architectural Styles and patterns
开发语言·算法·django·bug·结对编程
Roc-xb2 小时前
ModuleNotFoundError: No module named ‘conda_token‘
开发语言·python·conda
人工干智能3 小时前
Python 开发中:`.ipynb`(Jupyter Notebook 文件)和 `.py`(Python 脚本文件)
开发语言·python·jupyter
Jay-juice3 小时前
QT信号与槽
开发语言·qt
fs哆哆3 小时前
在VB.NET中,有没有 ?.这个运算符
java·开发语言·.net