3
Answers

Copy from one drpdown to another one by one

saifullah khan

saifullah khan

13y
2.3k
1
i have two dropdowns dr1,dr2 and a button. dr1 contains items. i want that when i select an item from dr1 and click on button so that selected item must be coppied into dr2. when i select item2 from dr1 and press the button again it copies that item into dr2. i have used a code but i doesnt work and gives and error. can somebody tell me what i need to do.
 
protected void Button1_Click(object sender, EventArgs e) { DropDownList2.Items.Add(DropDownList1.SelectedItem);   }
Answers (3)
1
Sujeet Suman

Sujeet Suman

NA 5.5k 199.5k 9y
David all classes means :
abstract class Vehicle
class Bicycle 
 
class Car
 
class Truck 
0
David Smith

David Smith

NA 1.9k 0 9y
Sujeet, Ok. Lets move on. We are going in circles. The example below is converted to past tense. Please tell me what If what I am writing if true. Also let me know if I can make this example below shorter. I don't want to over explain.
 
 

A-Action: In the software designing phase after soliciting requirements from

stakeholders I define and create an abstract polymorphism pattern.

I created an abstract vehicle class for types of vehicle, to reuse the

common behavior that can be use from the derived types of vehicle class..

By creating an abstract vehicle class I force all sub vehicle derived

classes to implement the common abstract methods.

 
0
Sujeet Suman

Sujeet Suman

NA 5.5k 199.5k 9y
David when you got all points & only you having past tense problem. Then why not you covert the scenario in past tense.
0
David Smith

David Smith

NA 1.9k 0 9y
Sujeet, I know you did. In your version I try to applied what you stated in your example. The only difference is your example is not in past tense. Check my task. I still had to do my example to make sure others and I can understand when I explain were and why I achieved polymorphism
 
Is there anything I did wrong in my example?
 

S- Situation: I'm glad you ask. A relevant example being at my last company

TATA MOTOR where I collaborated with mainframe developers to

produce a new vehicle module for our Transportation WPF Product

using the MVVM architectural pattern.

T-Task: My task was to design and develop software to maintain their

manufacturing material data for different types of Vehicle

like Bicycle, Car, Truck etc....

A-Action: In the software designing phase after soliciting requirements from

stakeholders I define and create an abstract polymorphism pattern.

I created an abstract vehicle class for types of vehicle, to reuse the

common behavior that can be use from the derived types of vehicle class..

By creating an abstract vehicle class I force all sub vehicle derived

classes to implement the common abstract methods.

R-Result: In the end I produced a successful loose-couple, extensible, and testable

module for our transportation module. The stakeholders were pleased with the

product.

 
0
Sujeet Suman

Sujeet Suman

NA 5.5k 199.5k 9y
David what you need I unable to recognize now. Where as I had explained all your points.
I think through below example (which I had already posted) you can easily explain all  things.
 
 
public abstract class Vehicle
{
public abstract int Wheels();
}
public class Bicycle : Vehicle
{
public override int Wheels()
{
return 2;
}
}
public class Car : Vehicle
{
public override int Wheels()
{
return 4;
}
}
public class Truck : Vehicle
{
public override int Wheels()
{
return 18;
}
}

S- Situation: (You are working for TATA MOTOR company as a sofrware Engineer.)

T-Task: (You have to develop a software to maintain their manufacturing material data for different type of vehicle like Bicycle, Car Truck etc.)

A-Action: (So now in software designing phase you have to define a class structure for different type of vehicle. So here you have seen that your requirement is to define classes for different type of vehicle first. So you defined 3 different classes Bicycle, Car & Truck. So now you should think that all vehicle having some common type of uses like tyres, engine, side mirror etc. & you have to maintain their specifications. IN DESIGNING PHASE WE ARE NOT DOING CODING ONLY DESIGNING A MODEL. So now you should create abstract class to keep commonly implemented / uses method like Wheels & inherit the abstract class by all different classes. So here you will see that all derived classes must be implement those abstract methods.

R-Result: (Then you should start implementation of design i.e. coding. So as a team you can work on & in this way your software will be developed.)

 
 
0
David Smith

David Smith

NA 1.9k 0 9y
Suthish,
 
The question is not what is Polymorshism. The question is explicitly How and were did you achieve Polymorphism? Also in any any interview you can use the STAR method show consistency in how you tell your story.
 
Suthish, in the example below, how would you explain the example below in the interview, one the interiview ask you How and were did you achieve Polymorphism?
 
public abstract class Vehicle 

{ public abstract int Wheels; }

public class Bicycle : Vehicle { public override int Wheels() { return 2; } }
public class Car : Vehicle { public override int Wheels() { return 4; } }
public class Truck : Vehicle { public override int Wheels() { return 18;
 
 
 
0
Suthish Nair

Suthish Nair

NA 31.7k 4.6m 9y
Hi David,
 
First of all, how did we achieve polymorphism in the example below using the STAR method statement is wrong.
 
The STAR method is a structured manner of responding to a behavioral-based interview question by
discussing the specific situation, task, action, and result of the situation you are describing.
 
The interviewer just used a method to discuss the topic (WHAT IS POLYMORPHISM).
 
So What is Polymorphism, How to achieve Polymorphism etc..
 
 
 
 
0
David Smith

David Smith

NA 1.9k 0 9y
What are ll classes?
0
David Smith

David Smith

NA 1.9k 0 9y
Correct. Mainframe is just simply you are on a team of 6 developers. We call them mainframe developers. Meaning they are the team of developers, I am collaborating with.
0
David Smith

David Smith

NA 1.9k 0 9y
Correct. Mainframe is just simply you are on a team of 6 developers. We call them mainframe developers. Meaning they are the team of developers, I am collaborating with.
0
Sujeet Suman

Sujeet Suman

NA 5.5k 199.5k 9y
David I think you didn't view properly my previous message.
Already I had explained every thing what you are asking in your last message. 
 
I a have no idea about mainframe but I know MVVM. So I know in MVVM we are keeping all classes, abstract classes & interfaces in MODEL. In VIEW MODEL initializing all MODEL classes & use VIEW to user interaction.
 
So all your class related Polymorphic  things should be appear in MODEL only.
 
So during interview when they ask about Polymorphism then you starts with MODEL and all same class structure as per my last message.
 
 
 
 
0
David Smith

David Smith

NA 1.9k 0 9y
Sujeet, Thanks. Let's build the example explain how did we achieve polymorphism in the example below using the STAR method. Let me know if i need to add or take away from example below
Interviewer: How and Were did you achieve polymorphism?
Response:

S- Situation: I'm glad you ask. A relevant example being at my last company

TATA MOTOR where I collaborated with mainframe developers to

produce a new vehicle module for our Transportation WPF Product

using the MVVM architectural pattern.

T-Task: My task was to design and develop software to maintain their

manufacturing material data for different types of Vehicle

like Bicycle, Car, Truck etc....

A-Action: In the software designing phase after soliciting requirements from

stakeholders I define and create an abstract polymorphism pattern.

I created an abstract vehicle class for types of vehicle.

By creating an abstract vehicle class I force all sub vehicle derived

classes to implement the common abstract methods.

R-Result: In the end I produced a successful loose-couple, extensible, and testable

module for our transportation module. The stakeholders were pleased with the

product.

0
Sujeet Suman

Sujeet Suman

NA 5.5k 199.5k 9y
David I unable to understand your STAR method problem that what you are asking. But as per my understanding I am trying to explain your example below. Please once go through.
 
public abstract class Vehicle
{
      public abstract int Wheels();
}
public class Bicycle : Vehicle
{
   public override int Wheels()
   {
      return 2;
   }
}
public class Car : Vehicle
{
   public override int Wheels()
   {
      return 4;
   }
}
public class Truck : Vehicle
{
   public override int Wheels()
   {
      return 18;
   }
}

S- Situation: (You are working for TATA MOTOR company as a sofrware Engineer.)

T-Task: (You have to develop a software to maintain their manufacturing material data for different type of vehicle like Bicycle, Car Truck etc.)

A-Action: (So now in software designing phase you have to define a class structure for different type of vehicle. So here you have seen that your requirement is to define classes for different type of vehicle first. So you defined 3 different classes Bicycle, Car & Truck. So now you should think that all vehicle having some common type of uses like tyres, engine, side mirror etc. & you have to maintain their specifications. IN DESIGNING PHASE WE ARE NOT DOING CODING ONLY DESIGNING A MODEL. So now you should create abstract class to keep commonly implemented / uses method like Wheels & inherit the abstract class by all different classes. So here you will see that all derived classes must be implement those abstract methods.

R-Result: (Then you should start implementation of design i.e. coding. So as a team you can work on & in this way your software will be developed.)

0
David Smith

David Smith

NA 1.9k 0 9y
Sujeet. I Completely understand what polymorphism. If you were in an interview, how would you describe this module on a phone interview using the  STAR method. Below is a simple polymorphism example. No need to give me a definition of polymorphism. Let's express it verbally. Write out your response for the below example.
 
 
public abstract class Vehicle 

{ public abstract int Wheels; }

public class Bicycle : Vehicle { public override int Wheels() { return 2; } }
public class Car : Vehicle { public override int Wheels() { return 4; } }
public class Truck : Vehicle { public override int Wheels() { return 18; } }

S- Situation (While working for company X.........)

T-Task (For this particular task I was responsible for......)

A-Action (The actions I took.......)

R-Result (The system implemented as team ........)


 
0
Sujeet Suman

Sujeet Suman

NA 5.5k 199.5k 9y
If you are working on some projects then I think already you had seen many times these things & scenario.
 
Directly I am coming on point polymorphism means: Overloading, Overriding
 
Overloading: So suppose you are working on a maintenance project. And you are working on a class where already parameterised constructors has defined & you need to pass some para meter. So what you will do, either add required parameter with one constructor or add new one as per your requirement. So you should not add required parameter with one constructor because this may disturb your other class dependency structure. So what you will do create a new constructor with requires parameter. That new constructor is nothing but constructor overloading.
 
Overriding: Suppose you need to add some custom feature to a control. Like you are using one treeview with checkbox & you would like to do something after click node or checkbox then you are overriding "OnAfterCheck" method of TreeView class (System.Windows.Forms.TreeView). i.e. when you would like to extend the features of some existing class then your need to override the existing class methods.
Now I think these are enough to say during interview.