Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
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