SlideShare a Scribd company logo
C++.NET
Windows Forms Course
L11-Inheritance

Mohammad Shaker
mohammadshakergtr.wordpress.com
C++.NET Windows Forms Course
@ZGTRShaker
C++ Windows Forms L11 - Inheritance
C++ Windows Forms L11 - Inheritance
C++ Windows Forms L11 - Inheritance
Inheritance
the concept
Inheritance
• Now, let’s have the following class:
#pragma once
using namespace::System;
ref class MyClass
{
public:
MyClass(void);
virtual String ^ToString() override;
};
Inheritance

#include "StdAfx.h"
#include "MyClass.h"
MyClass::MyClass(void)
{}

String^ MyClass::ToString()
{
return "I won't red 3leek :P:P ";
};
Inheritance
• What happens?
private: System::Void button1_Click(System::Object^
System::EventArgs^ e)
{
MyClass ^MC = gcnew MyClass;
textBox1->Text = MC->ToString();
}

sender,
Inheritance
• Let’s get it bigger a little
#pragma once
using namespace::System;
ref class MyClass
{
public:
MyClass(String^ s1, String^ s2);
virtual String ^ToString() override;
private:
String ^FName;
String ^LName;
};
Inheritance
#include "StdAfx.h"
#include "MyClass.h"
MyClass::MyClass(String^ s1, String^ s2)
{
FName = s1; LName = s2;
}

String^ MyClass::ToString()
{
return String::Format("{0}{1}{2}{3}", "My name is : ",
FName, " ", LName);
};
Inheritance
• What happens?
private: System::Void button1_Click(System::Object^ sender,
System::EventArgs^ e)
{
MyClass ^MC = gcnew MyClass("MeMe", "Auf-Wiedersehen");
textBox1->Text = MC->ToString();
}
Inheritance
• Let’s have the following ref class.
• Everything ok?
#pragma once

ref class MyClass : System::Windows::Forms::Button
{
public:
MyClass(void);
};
Compiler error, why?
Inheritance
#pragma once
using namespace System;

ref class MyClass : System::Windows::Forms::Button
{

public:
MyClass(void);
};
Inheritance
• Why doing this?
#pragma once
using namespace System;
namespace dotNet8_Inher {
ref class Form1;

Forward declaration

ref class MyClass : System::Windows::Forms::Button
{
public: MyClass(void);
};
}
Inheritance
• .cpp file
#include "StdAfx.h"
#include "MyClass.h"
namespace dotNet8_Inher {
MyClass::MyClass(void)
{}
}
Inheritance
• In Form1.h
private: System::Void Form1_Load(System::Object^
sender, System::EventArgs^ e)
{
MyClass ^MC = gcnew MyClass;
}

• Sth needed?  for Controls?
• In Form1.h
private: System::Void Form1_Load(System::Object^
sender, System::EventArgs^ e)
{
MyClass ^MC = gcnew MyClass;
MC->Parent = this;
}

• What will happen now?
Inheritance
Inheritance
• Now, let’s have the following in cpp file
#include "StdAfx.h"
#include "MyClass.h"

namespace dotNet8_Inher {
MyClass::MyClass(void)
{
this->Text = "I'M HAPPY!";
}
}
Inheritance
• Again, in Form1.h
private: System::Void Form1_Load(System::Object^
sender, System::EventArgs^ e)
{
MyClass ^MC = gcnew MyClass;
MC ->Parent = this;
}

• What will happen now?
Inheritance
#include "StdAfx.h"
#include "MyClass.h"

namespace dotNet8_Inher {
MyClass::MyClass(void)
{
this->Location = System::Drawing::Point(223, 121);
this->Name = L"button1";
this->Size = System::Drawing::Size(75, 23);
this->TabIndex = 0;
this->Text = L"My Button!";
this->UseVisualStyleBackColor = true;
}
}
private: System::Void Form1_Load(System::Object^
System::EventArgs^ e)
{
MyClass ^MC = gcnew MyClass;
MC ->Parent = this;
}

sender,
Inheritance
A way to steal :D
Multiple Inheritance
The concept
Multiple Inheritance
• Now, let’s see the following crazy code
#pragma once
using namespace System;
namespace dotNet8_Inheir {
ref class Form1;
ref class MyClass : System::Windows::Forms::Button,
System::Windows::Forms::ComboBox
{
private:
Form1 ^MyForm;
public:
MyClass(Form1 ^f);
};
}
#include "StdAfx.h"
#include "MyClass.h"

namespace dotNet8_Inheir {

MyClass::MyClass(void)
{
this->Location = System::Drawing::Point(223, 121);
this->Name = L"button1";
this->Size = System::Drawing::Size(75, 23);
this->TabIndex = 0;
this->Text = L"My Button!";
this->UseVisualStyleBackColor = true;
}
}
private: System::Void Form1_Load(System::Object^
System::EventArgs^ e)
{
MyClass ^MC = gcnew MyClass;
MC ->Parent = this;
}

sender,
Compiler error
Ambiguous, Why?
C++ Windows Forms L11 - Inheritance
Multiple Inheritance
• Why?
– Can’t know the “location” peoperties is for!
– Can’t inhert from more than one base class in.NET!

• So, what to do?
– Dump fix. (Do Not Do it (DNDI) unlsess necessary)
Multiple Inheritance - DNDI
#pragma once
using namespace System;
namespace dotNet8_Inheir {
ref class Form1;
ref class MyClass : public System::Windows::Forms::Button
{
private:
Form1 ^MyForm;
System::Windows::Forms::ComboBox ^MyCB;
public:
MyClass(Form1 ^f);
void InitializeButton();
void
InitializeComboBox(System::Windows::Forms::ComboBox ^%);
};
}
#include "StdAfx.h"
#include "MyClass.h”
namespace dotNet8_Inheir
{
MyClass::MyClass(Form1 ^f)
{
MyForm = f;
InitializeButton();
InitializeComboBox(MyCB);
}
void MyClass::InitializeButton()
{
this->Location = System::Drawing::Point(223, 121);
this->Name = L"button1";
this->Size = System::Drawing::Size(75, 23);
this->TabIndex = 0;
this->Text = L"My Button!";
this->UseVisualStyleBackColor = true;
}
void MyClass::InitializeComboBox(System::Windows::Forms::ComboBox ^%CB)
{
CB = gcnew System::Windows::Forms::ComboBox;
CB->Location = System::Drawing::Point(223, 121);
CB->Size = System::Drawing::Size(75, 23);
CB->TabIndex = 0;
CB->Text = L"My ComboBox!";
CB->Parent = this;
}
}
C++ Windows Forms L11 - Inheritance
Multiple Inheritance - DNDI
• Let’s start all over again
private: System::Void Form1_Load(System::Object^
System::EventArgs^ e)
{
MyClass ^MC;
MC = gcnew MyClass(this);
}

sender,
Multiple Inheritance - DNDI
#pragma once
using namespace System;
namespace dotNet8_Inheir {
ref class Form1;
ref class MyClass : public System::Windows::Forms::Button
{
private:
Form1 ^MyForm;
System::Windows::Forms::ComboBox ^MyCB;
public:
MyClass(Form1 ^f);
void InitializeButton();
void InitializeComboBox(System::Windows::Forms::ComboBox ^%);
void PlayIt(System::Object^ sender, System::EventArgs^ e);
void comboBox1_SelectedIndexChanged(System::Object^ sender,
System::EventArgs^ e);
};
}
#include "StdAfx.h"
#include "MyClass.h"
#include "Form1.h"
namespace dotNet8_Inheir
{
MyClass::MyClass(Form1 ^f)
{
MyForm = f;
this->Parent = MyForm;
InitializeButton();
InitializeComboBox(MyCB);
}

void MyClass::InitializeButton()
{
this->Button::Location = System::Drawing::Point(223, 121);
this->Name = L"button1";
this->Size = System::Drawing::Size(75, 23);
this->TabIndex = 0;
this->Text = L"My Button!";
this->UseVisualStyleBackColor = true;
this->Click += gcnew System::EventHandler(this, &MyClass::PlayIt);
}
void MyClass::InitializeComboBox(System::Windows::Forms::ComboBox ^%CB)
{
CB = gcnew System::Windows::Forms::ComboBox;
CB->FormattingEnabled = true;
CB->Location = System::Drawing::Point(100, 100);
CB->Size = System::Drawing::Size(121, 21);
CB->TabIndex = 2;
MyCB->Parent = MyClass::Parent;
CB->SelectedIndexChanged += gcnew System::EventHandler(this,
&MyClass::comboBox1_SelectedIndexChanged);
}
void MyClass::PlayIt(System::Object^ sender, System::EventArgs^ e)
{
Drawing::Point P = (dynamic_cast <Button^> (sender))->Location;
MyCB->Location = P;
}
void MyClass::comboBox1_SelectedIndexChanged(System::Object^
System::EventArgs^ e)

{
}
}

sender,
Multiple Inheritance - DNDI

After pressing the button
Keep in touch:
mohammadshakergtr@gmail.com
http://mohammadshakergtr.wordpress.com/
tweet @ZGTRShaker
Go have some fun!

More Related Content

PDF
C++ Windows Forms L09 - GDI P2
PDF
C++ Windows Forms L03 - Controls P2
PDF
C++ Windows Forms L02 - Controls P1
PDF
C++ Windows Forms L04 - Controls P3
PDF
C++ Windows Forms L05 - Controls P4
PDF
C++ Windows Forms L06 - Utlitity and Strings
PDF
C++ Windows Forms L10 - Instantiate
PDF
C++ Windows Forms L07 - Collections
C++ Windows Forms L09 - GDI P2
C++ Windows Forms L03 - Controls P2
C++ Windows Forms L02 - Controls P1
C++ Windows Forms L04 - Controls P3
C++ Windows Forms L05 - Controls P4
C++ Windows Forms L06 - Utlitity and Strings
C++ Windows Forms L10 - Instantiate
C++ Windows Forms L07 - Collections

What's hot (20)

PDF
C++ Windows Forms L08 - GDI P1
PDF
The Ring programming language version 1.8 book - Part 7 of 202
PPTX
Apache Flink Training: DataStream API Part 2 Advanced
DOCX
.net progrmming part4
PDF
Mocks introduction
PDF
The Ring programming language version 1.5.2 book - Part 7 of 181
DOCX
Dotnet 18
PPTX
Apache Flink Training: DataSet API Basics
PDF
Bot builder v4 HOL
PDF
Chat application in java using swing and socket programming.
PDF
final project for C#
PDF
C# Starter L07-Objects Cloning
PDF
Functional Stream Processing with Scalaz-Stream
PDF
The Ring programming language version 1.3 book - Part 83 of 88
PDF
Writing Domain-Specific Languages for BeepBeep
PDF
Chat Room System using Java Swing
DOCX
Java programs
PDF
FS2 for Fun and Profit
PDF
Comparing JVM languages
C++ Windows Forms L08 - GDI P1
The Ring programming language version 1.8 book - Part 7 of 202
Apache Flink Training: DataStream API Part 2 Advanced
.net progrmming part4
Mocks introduction
The Ring programming language version 1.5.2 book - Part 7 of 181
Dotnet 18
Apache Flink Training: DataSet API Basics
Bot builder v4 HOL
Chat application in java using swing and socket programming.
final project for C#
C# Starter L07-Objects Cloning
Functional Stream Processing with Scalaz-Stream
The Ring programming language version 1.3 book - Part 83 of 88
Writing Domain-Specific Languages for BeepBeep
Chat Room System using Java Swing
Java programs
FS2 for Fun and Profit
Comparing JVM languages
Ad

Similar to C++ Windows Forms L11 - Inheritance (20)

PPTX
PPTX
Anti patterns
PDF
A la découverte de TypeScript
PDF
Java VS Python
PDF
The Ring programming language version 1.5.3 book - Part 12 of 184
PDF
The Ring programming language version 1.9 book - Part 54 of 210
PDF
delegates
PPT
Namespace
PDF
Java programming lab manual
PPTX
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
DOCX
Diifeerences In C#
PPTX
Object Oriented Programming Using C++: C++ Namespaces.pptx
KEY
Gae icc fall2011
PDF
XAML/C# to HTML/JS
PPTX
Collection
PPTX
Closer look at classes
PDF
The Ring programming language version 1.3 book - Part 5 of 88
PPTX
Presentation.pptx
PPTX
Ensure code quality with vs2012
Anti patterns
A la découverte de TypeScript
Java VS Python
The Ring programming language version 1.5.3 book - Part 12 of 184
The Ring programming language version 1.9 book - Part 54 of 210
delegates
Namespace
Java programming lab manual
Callbacks, Promises, and Coroutines (oh my!): Asynchronous Programming Patter...
Diifeerences In C#
Object Oriented Programming Using C++: C++ Namespaces.pptx
Gae icc fall2011
XAML/C# to HTML/JS
Collection
Closer look at classes
The Ring programming language version 1.3 book - Part 5 of 88
Presentation.pptx
Ensure code quality with vs2012
Ad

More from Mohammad Shaker (20)

PDF
12 Rules You Should to Know as a Syrian Graduate
PDF
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
PDF
Interaction Design L06 - Tricks with Psychology
PDF
Short, Matters, Love - Passioneers Event 2015
PDF
Unity L01 - Game Development
PDF
Android L07 - Touch, Screen and Wearables
PDF
Interaction Design L03 - Color
PDF
Interaction Design L05 - Typography
PDF
Interaction Design L04 - Materialise and Coupling
PDF
Android L05 - Storage
PDF
Android L04 - Notifications and Threading
PDF
Android L09 - Windows Phone and iOS
PDF
Interaction Design L01 - Mobile Constraints
PDF
Interaction Design L02 - Pragnanz and Grids
PDF
Android L10 - Stores and Gaming
PDF
Android L06 - Cloud / Parse
PDF
Android L08 - Google Maps and Utilities
PDF
Android L03 - Styles and Themes
PDF
Android L02 - Activities and Adapters
PDF
Android L01 - Warm Up
12 Rules You Should to Know as a Syrian Graduate
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]
Interaction Design L06 - Tricks with Psychology
Short, Matters, Love - Passioneers Event 2015
Unity L01 - Game Development
Android L07 - Touch, Screen and Wearables
Interaction Design L03 - Color
Interaction Design L05 - Typography
Interaction Design L04 - Materialise and Coupling
Android L05 - Storage
Android L04 - Notifications and Threading
Android L09 - Windows Phone and iOS
Interaction Design L01 - Mobile Constraints
Interaction Design L02 - Pragnanz and Grids
Android L10 - Stores and Gaming
Android L06 - Cloud / Parse
Android L08 - Google Maps and Utilities
Android L03 - Styles and Themes
Android L02 - Activities and Adapters
Android L01 - Warm Up

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
KodekX | Application Modernization Development
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Cloud computing and distributed systems.
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Encapsulation theory and applications.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Encapsulation_ Review paper, used for researhc scholars
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
NewMind AI Weekly Chronicles - August'25 Week I
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
KodekX | Application Modernization Development
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Cloud computing and distributed systems.
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
cuic standard and advanced reporting.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Programs and apps: productivity, graphics, security and other tools
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Understanding_Digital_Forensics_Presentation.pptx

C++ Windows Forms L11 - Inheritance

  • 1. C++.NET Windows Forms Course L11-Inheritance Mohammad Shaker mohammadshakergtr.wordpress.com C++.NET Windows Forms Course @ZGTRShaker
  • 6. Inheritance • Now, let’s have the following class: #pragma once using namespace::System; ref class MyClass { public: MyClass(void); virtual String ^ToString() override; };
  • 7. Inheritance #include "StdAfx.h" #include "MyClass.h" MyClass::MyClass(void) {} String^ MyClass::ToString() { return "I won't red 3leek :P:P "; };
  • 8. Inheritance • What happens? private: System::Void button1_Click(System::Object^ System::EventArgs^ e) { MyClass ^MC = gcnew MyClass; textBox1->Text = MC->ToString(); } sender,
  • 9. Inheritance • Let’s get it bigger a little #pragma once using namespace::System; ref class MyClass { public: MyClass(String^ s1, String^ s2); virtual String ^ToString() override; private: String ^FName; String ^LName; };
  • 10. Inheritance #include "StdAfx.h" #include "MyClass.h" MyClass::MyClass(String^ s1, String^ s2) { FName = s1; LName = s2; } String^ MyClass::ToString() { return String::Format("{0}{1}{2}{3}", "My name is : ", FName, " ", LName); };
  • 11. Inheritance • What happens? private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { MyClass ^MC = gcnew MyClass("MeMe", "Auf-Wiedersehen"); textBox1->Text = MC->ToString(); }
  • 12. Inheritance • Let’s have the following ref class. • Everything ok? #pragma once ref class MyClass : System::Windows::Forms::Button { public: MyClass(void); }; Compiler error, why?
  • 13. Inheritance #pragma once using namespace System; ref class MyClass : System::Windows::Forms::Button { public: MyClass(void); };
  • 14. Inheritance • Why doing this? #pragma once using namespace System; namespace dotNet8_Inher { ref class Form1; Forward declaration ref class MyClass : System::Windows::Forms::Button { public: MyClass(void); }; }
  • 15. Inheritance • .cpp file #include "StdAfx.h" #include "MyClass.h" namespace dotNet8_Inher { MyClass::MyClass(void) {} }
  • 16. Inheritance • In Form1.h private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyClass ^MC = gcnew MyClass; } • Sth needed? for Controls? • In Form1.h private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyClass ^MC = gcnew MyClass; MC->Parent = this; } • What will happen now?
  • 18. Inheritance • Now, let’s have the following in cpp file #include "StdAfx.h" #include "MyClass.h" namespace dotNet8_Inher { MyClass::MyClass(void) { this->Text = "I'M HAPPY!"; } }
  • 19. Inheritance • Again, in Form1.h private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) { MyClass ^MC = gcnew MyClass; MC ->Parent = this; } • What will happen now?
  • 21. #include "StdAfx.h" #include "MyClass.h" namespace dotNet8_Inher { MyClass::MyClass(void) { this->Location = System::Drawing::Point(223, 121); this->Name = L"button1"; this->Size = System::Drawing::Size(75, 23); this->TabIndex = 0; this->Text = L"My Button!"; this->UseVisualStyleBackColor = true; } } private: System::Void Form1_Load(System::Object^ System::EventArgs^ e) { MyClass ^MC = gcnew MyClass; MC ->Parent = this; } sender,
  • 23. A way to steal :D
  • 25. Multiple Inheritance • Now, let’s see the following crazy code #pragma once using namespace System; namespace dotNet8_Inheir { ref class Form1; ref class MyClass : System::Windows::Forms::Button, System::Windows::Forms::ComboBox { private: Form1 ^MyForm; public: MyClass(Form1 ^f); }; }
  • 26. #include "StdAfx.h" #include "MyClass.h" namespace dotNet8_Inheir { MyClass::MyClass(void) { this->Location = System::Drawing::Point(223, 121); this->Name = L"button1"; this->Size = System::Drawing::Size(75, 23); this->TabIndex = 0; this->Text = L"My Button!"; this->UseVisualStyleBackColor = true; } } private: System::Void Form1_Load(System::Object^ System::EventArgs^ e) { MyClass ^MC = gcnew MyClass; MC ->Parent = this; } sender,
  • 29. Multiple Inheritance • Why? – Can’t know the “location” peoperties is for! – Can’t inhert from more than one base class in.NET! • So, what to do? – Dump fix. (Do Not Do it (DNDI) unlsess necessary)
  • 30. Multiple Inheritance - DNDI #pragma once using namespace System; namespace dotNet8_Inheir { ref class Form1; ref class MyClass : public System::Windows::Forms::Button { private: Form1 ^MyForm; System::Windows::Forms::ComboBox ^MyCB; public: MyClass(Form1 ^f); void InitializeButton(); void InitializeComboBox(System::Windows::Forms::ComboBox ^%); }; }
  • 31. #include "StdAfx.h" #include "MyClass.h” namespace dotNet8_Inheir { MyClass::MyClass(Form1 ^f) { MyForm = f; InitializeButton(); InitializeComboBox(MyCB); } void MyClass::InitializeButton() { this->Location = System::Drawing::Point(223, 121); this->Name = L"button1"; this->Size = System::Drawing::Size(75, 23); this->TabIndex = 0; this->Text = L"My Button!"; this->UseVisualStyleBackColor = true; } void MyClass::InitializeComboBox(System::Windows::Forms::ComboBox ^%CB) { CB = gcnew System::Windows::Forms::ComboBox; CB->Location = System::Drawing::Point(223, 121); CB->Size = System::Drawing::Size(75, 23); CB->TabIndex = 0; CB->Text = L"My ComboBox!"; CB->Parent = this; } }
  • 33. Multiple Inheritance - DNDI • Let’s start all over again private: System::Void Form1_Load(System::Object^ System::EventArgs^ e) { MyClass ^MC; MC = gcnew MyClass(this); } sender,
  • 34. Multiple Inheritance - DNDI #pragma once using namespace System; namespace dotNet8_Inheir { ref class Form1; ref class MyClass : public System::Windows::Forms::Button { private: Form1 ^MyForm; System::Windows::Forms::ComboBox ^MyCB; public: MyClass(Form1 ^f); void InitializeButton(); void InitializeComboBox(System::Windows::Forms::ComboBox ^%); void PlayIt(System::Object^ sender, System::EventArgs^ e); void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e); }; }
  • 35. #include "StdAfx.h" #include "MyClass.h" #include "Form1.h" namespace dotNet8_Inheir { MyClass::MyClass(Form1 ^f) { MyForm = f; this->Parent = MyForm; InitializeButton(); InitializeComboBox(MyCB); } void MyClass::InitializeButton() { this->Button::Location = System::Drawing::Point(223, 121); this->Name = L"button1"; this->Size = System::Drawing::Size(75, 23); this->TabIndex = 0; this->Text = L"My Button!"; this->UseVisualStyleBackColor = true; this->Click += gcnew System::EventHandler(this, &MyClass::PlayIt); }
  • 36. void MyClass::InitializeComboBox(System::Windows::Forms::ComboBox ^%CB) { CB = gcnew System::Windows::Forms::ComboBox; CB->FormattingEnabled = true; CB->Location = System::Drawing::Point(100, 100); CB->Size = System::Drawing::Size(121, 21); CB->TabIndex = 2; MyCB->Parent = MyClass::Parent; CB->SelectedIndexChanged += gcnew System::EventHandler(this, &MyClass::comboBox1_SelectedIndexChanged); } void MyClass::PlayIt(System::Object^ sender, System::EventArgs^ e) { Drawing::Point P = (dynamic_cast <Button^> (sender))->Location; MyCB->Location = P; } void MyClass::comboBox1_SelectedIndexChanged(System::Object^ System::EventArgs^ e) { } } sender,
  • 37. Multiple Inheritance - DNDI After pressing the button
  • 39. Go have some fun!