Maple für Professional
Maple für Akademiker
Maple für Studenten
Maple Personal Edition
Maple Player
Maple Player für iPad
MapleSim für Professional
MapleSim für Akademiker
Maple T.A. - Testen & beurteilen
Maple T.A. MAA Placement Test Suite
Möbius - Online-Courseware
Machine Design / Industrial Automation
Luft- und Raumfahrt
Fahrzeugtechnik
Robotics
Energiebranche
System Simulation and Analysis
Model development for HIL
Anlagenmodelle für den Regelungsentwurf
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematikausbildung
Technik
Allgemein- und berufsbildende Schulen
Testen und beurteilen
Studierende
Finanzmodelle
Betriebsforschung
Hochleistungsrechnen
Physik
Live-Webinare
Aufgezeichnete Webinare
Geplante Veranstaltungen
MaplePrimes
Maplesoft-Blog
Maplesoft-Mitgliedschaft
Maple Ambassador Program
MapleCloud
Technische Whitepapers
E-Mail Newsletters
Maple-Bücher
Math Matters
Anwendungs-Center
MapleSim Modell-Galerie
Anwenderberichte
Exploring Engineering Fundamentals
Lehrkonzepte mit Maple
Maplesoft Welcome-Center
Resource-Center für Lehrer
Help-Center für Studierende
Object - クラスの新規インスタンスを作成
使い方
Object( obj )
Object( obj, arg1, ... )
パラメータ
obj
-
オブジェクトのインスタンス
arg1, ...
ModuleCopy ルーチンの引数
Object ルーチンは、与えられたオブジェクトをコピーして新規の object を作成します。
新規オブジェクトの宣言に関する詳細は、Object,create を参照してください。Maple におけるオブジェクトの概要については、object を参照してください。
与えられたオブジェクトが ModuleCopy ルーチンを実装していない場合、Object はオブジェクト obj の static でないメンバーの値を新規オブジェクトにコピーします。
オブジェクトが ModuleCopy ルーチンを実装している場合は、Object を呼び出すと ModuleCopy ルーチンを実行します。追加パラメータ (arg1, ...) も ModuleCopy ルーチンに渡されます。
ModuleCopy を実行する Object を呼び出す ModuleApply ルーチンを実装し、オブジェクトにプロトタイプオブジェクトを適用します。
互換性
Object コマンドは Maple 16 で導入されました。
Maple 16 における変更点についての詳細は、Maple 16 の新機能 を参照してください。
例
module Obj() option object; local data := 0; export getData::static := proc( self::Obj ) self:-data; end; export setData::static := proc( self::Obj, d ) self:-data := d; end; end:
getData( Obj );
newObj1 := Object( Obj );
getData( newObj1 );
setData( newObj1, 10 );
newObj2 := Object( newObj1 );
getData( newObj2 );
module Obj2() option object; local data := 0; export getData::static := proc( self::Obj2 ) self:-data; end; export ModuleCopy::static := proc( self::Obj2, proto::Obj2, d, $ ) if ( _npassed = 2 ) then self:-data := proto:-data; else self:-data := d; end; end; end:
getData( Obj2 );
newObj1 := Object( Obj2 );
newObj2 := Object( Obj2, 10 );
module Obj3() option object; local data := 0; export getData::static := proc( self::Obj3 ) self:-data; end; export ModuleApply::static := proc( ) Object( Obj3, _passed ); end; export ModuleCopy::static := proc( self::Obj3, proto::Obj3, d, $ ) if ( _npassed = 2 ) then self:-data := proto:-data; else self:-data := d; end; end; end:
newObj1 := Obj3( );
newObj2 := Obj3( 10 );
関連項目
ModuleApply、ModuleCopy、object、Object,builtin、Object,create、Object,method、Object,operators、procedure
Download Help Document