public void RemovePane(baseClass.controls.graphPanel myPane) { mainContainer.Controls.Remove(myPane); mainContainer.RemoveChild(myPane.Name); myPane.Dispose(); ReArrangePanes(); }
public static void Main() { // The obj variable is set as the // new baseClass(). As a result // obj.show() will invoke the method // from baseClass which is printing // "Base class." baseClass obj; obj = new baseClass(); obj.show(); // The same obj variable is now // declared as the new derived() // class. As a result, even though // it is a child class and inherits // the base class' method, the override // modifier was used to override // the baseClass method. As a result, // obj.show() will only print the derived // class' "Derived class." obj = new derived(); obj.show(); // If the derived class did not use override // modifier, obj.show() would invoke the // base method and its derived method. // The final output would have instead // displayed: // Base class // Base class }
public baseClass.controls.graphPanel CreatePane(baseClass.controls.graphPanel myPane, string underPaneName) { mainContainer.Controls.Add(myPane); myPane.myContainer = mainContainer; mainContainer.InsertChild(underPaneName, myPane, myPane.Name); mainContainer.ArrangeChildren(); return myPane; }
// Use this for initialization void Start() { baseClass baseClassInstance = new baseClass(2); //派生类并不能继承基类中定义的含一个参数的构造函数 //derivedClass derivedClass = new derivedClass(3); //在实例化派生类时,先要实例化其基类,逐步向上推,因此会从最基础的基类的构造函数开始逐步向下执行 derivedClass2 derivedClass2Instance = new derivedClass2(); }
//public class seaInhClass : seaClass { } // Use this for initialization void Start() { baseClass baseClassInstance = new baseClass(); derivedClass deriveClassInstacne = new derivedClass(); baseClassInstance.virMethod(); deriveClassInstacne.virMethod(); //没有override过的虚方法采用基类中的实现 baseClassInstance.virMethod2(); deriveClassInstacne.virMethod2(); }
public List <string> Get() { var output = new List <string>(); baseClass obj; obj = new baseClass(); output.Add(obj.show()); obj = new derivedClass(); output.Add(obj.show()); return(output); }
// Use this for initialization void Start() { baseClass instanceBaseClass = new baseClass(); derivedClass instanceDerivedClass = new derivedClass(); //基类实例调用基类方法 instanceBaseClass.methodInBaseClass(); //派生类实例调用派生类方法 instanceDerivedClass.methodInDerivedClass(); //派生类实例调用基类公共字段 print(instanceDerivedClass.intInBaseClass); //派生类实例调用基类公共方法 instanceDerivedClass.methodInBaseClass(); }
void Start() { baseClass baseClassInstance = new baseClass(); derivedClass derivedClassInstance = new derivedClass(); //基类实例无法转换为派生类,结果为null print(baseClassInstance as derivedClass); //派生类实例可以转换为基类,结果为派生类 print(derivedClassInstance as baseClass); //基类实例可以转换为所支持的接口 print(baseClassInstance as myInterface); //若基类实例支持某接口,则其派生类实例亦可转换为所支持的接口 print(derivedClassInstance as myInterface); }
// Main Method public static void Main() { // 'obj' is the object of // class 'baseClass' baseClass obj = new baseClass(); // invokes the method 'show()' // of class 'baseClass' obj.show(); obj = new derived(); // it also invokes the method // 'show()' of class 'baseClass' obj.show(); }
// Use this for initialization void Start() { baseClass baseClassInstance = new baseClass(); derivedClass derivedClassInstance = new derivedClass(); //假若<A>is<B>中,<A>是<B>或<B>的派生类的实例,则返回true print(derivedClassInstance is derivedClass); print(derivedClassInstance is baseClass); classWithInterface classWithInterfaceInstance = new classWithInterface(); myInterface myInterfaceInstance = classWithInterfaceInstance; //接口变量与接口进行比较 print(myInterfaceInstance is myInterface); //实例与接口进行比较 print(classWithInterfaceInstance is myInterface); }
// Main Method to test out the overridden methods public static void Main() { baseClass obj; //object of the base class is instantiated to test out baseclass method obj = new baseClass(); //baseclass object utilizes baseclass method obj.show(); //derived class object is instantiated obj = new derived(); //derived class object calls on the same method but the one used is the one ovveridden in the derived class obj.show(); }
//class derivedClass3 : sealedClass { } // Impossible car sealedClass est SEALED public static void execute() { char exec = '-'; if (exec == '+') { Console.WriteLine("Exemple d'utilisation de classe abstraite ou sealed:\r\n"); baseClass bc = new baseClass(); derivedClass dc = new derivedClass(); baseClass bcdc = new derivedClass(); // une instance de derivedClass référencé par un type baseClass bc.methode1(); // Base: methode1 bc.methode2(); // Base: methode2 dc.methode1(); // Derived: methode1 dc.methode2(); // Derived: methode2 bcdc.methode1(); // Base: methode1 -> new a remplacé methode1 DANS derivedClass pas dans baseClass OR bcdc REFERENCE un type baseClass bcdc.methode2(); // Derived: methode2 -> override a remplacé methode2 DANS baseClass DONC la REFERENCE à baseClass utilise la methode de derivedClass Console.WriteLine("\r\n"); } }
// Main Method public static void Main() { baseClass obj; // 'obj' is the object // of class 'baseClass' obj = new baseClass(); // it invokes 'show()' // of class 'baseClass' obj.show(); // the same object 'obj' is now // the object of class 'derived' obj = new derived(); // it invokes 'show()' of class 'derived' // 'show()' of class 'derived' is overridden // for 'override' modifier obj.show(); }
public System.Object initializeClass(string className, string revicedObj) { // System.Object retunedClass = new System.Object(); baseClass retunedClass = new baseClass(); try { Type elementType = Type.GetType(className, true); if (elementType != null) { retunedClass = (baseClass)(Activator.CreateInstance(elementType)); string feedback = retunedClass.init(revicedObj); Debug.Log(feedback); } } catch (Exception ex) { Debug.Log(ex.Message); Debug.Log("The client request this class, but dosen't exist!"); } return(retunedClass); }
public System.Object initializeCass(string className, string revicedObj) { // System.Object retunedClass = new System.Object(); baseClass retunedClass = new baseClass(); try { Type elementType = Type.GetType(className, true); if (elementType != null) { retunedClass = (baseClass) (Activator.CreateInstance(elementType)); string feedback = retunedClass.init(revicedObj); Debug.Log(feedback); } } catch (Exception ex) { Debug.Log(ex.Message); Debug.Log("The client request this class, but dosen't exist!"); } return retunedClass; }
protected void ClearStrategyTradepoints(baseClass.controls.graphPanel toPanel) { toPanel.myGraphObj.myGraphPane.GraphObjList.Clear(); toPanel.myGraphObj.UpdateChart(); }
/// <summary> /// /// </summary> protected void PlotStrategyTradepoints(application.Strategy.Data.TradePoints tradePoints, baseClass.controls.graphPanel toPanel) { ClearStrategyTradepoints(toPanel); Charts.DrawCurve[] curveList = myCurveList.CurveInPane(toPanel.Name); if (curveList.Length == 0) return; CurveItem curveItem = curveList[0].Curve; TradePointInfo tradePointInfo; for (int idx = 0; idx < tradePoints.Count; idx++) { tradePointInfo = (TradePointInfo)tradePoints[idx]; if (!tradePointInfo.isValid) continue; TextObj obj = new TextObj(); obj.FontSpec.Size = Settings.sysTradePointMarkerFontSize; obj.FontSpec.IsBold = true; obj.FontSpec.Border.IsVisible = true; obj.FontSpec.Fill.IsVisible = true; obj.FontSpec.Fill.Color = Settings.sysTradePointMarkerColorBG; switch (toPanel.myGraphObj.myViewportState.myAxisType) { case Charts.AxisType.DateAsOrdinal : obj.Location.X = tradePointInfo.DataIdx+1; break; default: obj.Location.X = curveItem.Points[tradePointInfo.DataIdx].X; break; } obj.Location.Y = curveItem.Points[tradePointInfo.DataIdx].Y; obj.Location.CoordinateFrame = CoordType.AxisXYScale; obj.Location.AlignH = AlignH.Center; switch (tradePointInfo.TradeAction) { case AppTypes.TradeActions.Buy: case AppTypes.TradeActions.Accumulate: obj.Text = Settings.sysTradePointMarkeBUY; obj.FontSpec.FontColor = Settings.sysTradePointMarkerColorBUY; break; case AppTypes.TradeActions.Sell: case AppTypes.TradeActions.ClearAll: obj.Text = Settings.sysTradePointMarkerSELL; obj.FontSpec.FontColor = Settings.sysTradePointMarkerColorSELL; break; default: obj.Text = Settings.sysTradePointMarkerOTHER; obj.FontSpec.FontColor = Settings.sysTradePointMarkerColorOTHER; break; } toPanel.myGraphObj.myGraphPane.GraphObjList.Add(obj); } toPanel.myGraphObj.UpdateChart(); }
internal void Remove(baseClass.controls.graphPanel pane) { this.Remove(pane.Name); }
//Hashtable list = new Hashtable(); internal void Add(baseClass.controls.graphPanel panel) { this.Add(panel.Name,panel); }
private void ShowAnalysisForm(string stockCode,baseClass.controls.chartTiming timing) { //data.baseDS.stockCodeRow stockCodeRow = application.dataLibs.FindAndCache(myDataSet.stockCode, stockCode); //myTradeAnalysisForm.ShowForm(stockCodeRow, timing); }
public void RefreshData(baseClass.controls.stockCodeSelectByWatchList.RefreshOptions options) { DoRefreshData(options); }
public void Main(string[] args) { baseClass obj1 = new baseClass(); baseClass obj2 = new baseClass(12, "sparrow"); }
public void Main(string[] args) { baseClass obj1 = new baseClass(); }
//paramterless baseClass(baseClass bs) { bs.birdAge = 25; bs.birdName = "Eagle"; }
public static void Calculate(baseClass S) { Console.WriteLine("Area :", S.area()); }
public List<CogObject> getGroupsAndRoles() { propEnum[] props = new propEnum[] { propEnum.defaultName, propEnum.searchPath, propEnum.type, propEnum.members, propEnum.objectClass }; // Properties used to get account class information for the members refProp memberProps = new refProp(); memberProps.refPropName = propEnum.members; memberProps.properties = new propEnum[] { propEnum.searchPath, propEnum.defaultName, propEnum.userName, propEnum.objectClass }; baseClass[] securityObjects = new baseClass[]{}; searchPathMultipleObject spMulti = new searchPathMultipleObject(); account[] targetAccount = null; List<CogObject> cogObjects = new List<CogObject>(); queryOptions qo = new queryOptions(); qo.refProps = new refProp[] { memberProps }; // Set search path to pull back all groups and roles in Cognos spMulti.Value = "CAMID(\"ADS:f:ou=enterprise reporting,ou=applications,ou=tyson groups\")//group | //group | //role"; Console.WriteLine(spMulti.Value); // Query for all groups and roles try { securityObjects = cCMS.query(spMulti, props, new sort[] { }, qo); } catch (Exception ex) { Console.WriteLine(ex); } if (securityObjects.Length <= 0) { Console.WriteLine("No roles or groups were found."); } // Loop through groups and roles and get members for each foreach (baseClass securityObject in securityObjects) { baseClass[] members = new baseClass[] { }; searchPathMultipleObject membersPath = new searchPathMultipleObject(); membersPath.Value = "expandMembers(" + securityObject.searchPath.value + ")"; // Attempt to get members for the group or role try { members = cCMS.query(membersPath, props, new sort[] { }, new queryOptions()); // Loop through members of the group foreach (account account in members) { CogObject user = new CogObject(); user.AddAttribute("user", account.defaultName.value); if (securityObject is role) { user.AddAttribute("categoryType", "role"); } else if (securityObject is group) { user.AddAttribute("categoryType", "group"); } else { user.AddAttribute("categoryType", "unknown"); } user.AddAttribute("categoryName", securityObject.defaultName.value); cogObjects.Add(user); } } catch (Exception ex) { Console.WriteLine(ex); } } return cogObjects; }
// Use this for initialization void Start() { IDictionary <string, string> Idic = new Dictionary <string, string>(); Dictionary <string, string> dic = new Dictionary <string, string>(); Idic.Add("lzd", "1234"); dic.Add("lzd", "lzd"); TestDic(Idic); TestDic(dic); Debug.Log(Idic); Debug.Log(dic); // IDictionary<string, string> Idic = new Dictionary<string, string>(); // Dictionary<string, string> dic = new Dictionary<string, string>(); // Idic.Add("lzd","1234"); // dic.Add("lzd", "lzd"); // TestDic(Idic); // TestDic(dic); // long scienceNum = 100000000000000000; // Debug.Log(scienceNum.ToString("###,###")); //千分位 // int money = 100; // Debug.Log(string.Format("{0:C}", money)); //货币格式化 // Keyframe[] keyframes = new Keyframe[]{new Keyframe(0, 0), new Keyframe(1, 5), new Keyframe(2, 0), new Keyframe(3, 5), new Keyframe(4, 0)}; // keyframes[0].outTangent = 5.0f; // keyframes[1].outTangent = 0; // keyframes[2].outTangent = -5.0f; // animationCurve = new AnimationCurve(keyframes); // //animationCurve = AnimationCurve.EaseInOut(0, 1, 1, 10); // animationCurve.preWrapMode = WrapMode.Loop; // animationCurve.postWrapMode = WrapMode.Loop; // float a = 1, b = 2; // try // { // if(a == 1) // throw(new Exception("trow exception message")); // b = 3; // Debug.LogError(b); // } // catch // { // } // string s1 = ""; // string s2 = ""; // TestRef(ref s1); // TestOut(out s2); //TestOut() superClass testclass = new superClass(); //子类可以直接转换成父类 baseClass bc = (baseClass)testclass; bc.ShowName(); baseClass bs = new baseClass(); //superClass sc_2 = (superClass)bs; //父类是不能直接转换为子类的 baseClass bs_2 = new superClass(); superClass sc_3 = bs_2 as superClass; //父类指向的是子类对象,可以转换成子类 sc_3.ShowName(); superClass sc = bc as superClass; testclass.ShowName(); // gameObject.transform.Find("Capsule").gameObject.SetActive(false); DateTime dayofyear = DateTime.UtcNow; Debug.Log(dayofyear.ToString()); Debug.Log(DateTime.Now.DayOfYear); }