汽车电子 - 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
相关推荐
BUG研究员_21 小时前
Runnable与LCEL
开发语言·人工智能·python
牛艺翔1 天前
C++基础
开发语言·c++
键盘会跳舞1 天前
C++ :容器适配器stack源码级拆解
开发语言·c++··stack·先进后出
美味蛋炒饭.1 天前
Git 版本控制(下)
开发语言·git·学习·总结·后端开发
我星期八休息1 天前
网络编程—网络层
开发语言·前端·网络·人工智能·智能路由器
问商十三载1 天前
RAG 检索效果差怎么排查?2026 五层诊断法完整指南
开发语言·人工智能·windows·python·算法
不负岁月无痕1 天前
简单理解操作系统结构
java·linux·c语言·开发语言·c++·面试
SomeB1oody1 天前
【RustyML入门】2.9. MeanShift
开发语言·后端·机器学习·rust·教程
萧瑟其中~1 天前
多线程锁详解:互斥锁·自旋锁·读写锁(CAS + futex 原理)
开发语言·c++
qq_448011161 天前
C语言中的指针函数和函数指针
java·c语言·开发语言