[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

clarification about the key word "implements"

I somewhat asked this question before but was to quick to accept the answer...
see http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21825320.html

my question was "how do I make my app such that it implements a custom form object?"

now ..does the customForm..need to be an Interface? i.e for me to say that it implements? or is it fine they way I done it? (see link for code)
0
Thunder_scream
Asked:
Thunder_scream
  • 7
  • 6
1 Solution
 
mrichmonCommented:
When you have this syntax:

class1 : class2

then class1 is said to inherit from class2

If instead you have

class1 : interface1

then class1 is said to implement interface1

The terminology (inherit vs implement) is generally based on if the part after the : is a class or an interface.

You can even have both:

class1: class2, interface1, interface2

Then class 1 inherits from class2 and implements both interface1 and interface2

You can implement multiple interfaces, but only inherit from one class in C#
0
 
Thunder_screamAuthor Commented:
so if I say create some application (nevermind what) that implements a custom form object. Then that would mean

not the same as GENTP said but almost in the post given by the link above but it should be

public interface ImyCustomForm
{
methods with no implementation
}

class frmMain : ImyCustomForm, System.Windows.Forms.Form
{
 // Program code goes here
}




0
 
mrichmonCommented:
Not totally sure what you asked there, but in your example frmMain inherits System.Windows.Forms.Form and implements ImyCustomForm.

That means that in tests

frmMain "IS A" System.Windows.Forms.Form

So it most likely has a few extra custom fields/methods than a standard form correct?

Also the required methods would be defined by the interface ImyCustomForm.  However there could be additional ones.

Does that help?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Thunder_screamAuthor Commented:
well I dont know really ...I'm trying to do a exercis in the book OReilly.Learning.C.Sharp.2005 and the question says

"create a application where forinstance a button click will change the colour of the form background. Create this verison such that it implements a custom form object."


Now I'm not sure what hte question is saying... I thought the key work implements indicate it must be a interface of some sort that must be implemented? right?
0
 
mrichmonCommented:
Well.  You have to be careful there.  The authors aren't always careful in using  words that also are keywords.  Often if they mean the "implements" of the language the font will be different or it will be in italics, etc.  Otherwise they are often just using a word telling you to do something - i.e. the normal non-C# definition of implement.

One other way to tell is : is the chapter talking about interfaces?  If so then the excerice most likely means use an interface.  If not then the use of the word is up for debate.
0
 
Thunder_screamAuthor Commented:
yes you might be right about that

btw could the key work implements be used when one uses an abstract class?

Cheers
0
 
mrichmonCommented:
Sometimes it is used to say you must implement an abstract function defined in the base class.  In that case since it is abstract you must implement it.  AN interface is like a totally abstract class in a way in that it too defines the methods that must be implemented.
0
 
Thunder_screamAuthor Commented:
I think you are right about the interpretation of implements. Before I accept your answer I just want your opionion on what a custom form object might be. I understand it as anyform as soon as you put some code it (changing the title etc) is customized right...in other words the question just says create this application using a form, or do you think it might be that the author wants a customized shape on the form?

btw I've increased the points
0
 
mrichmonCommented:
It is hard to tell taken out of context of the chapter on what the author means there by "Create this verison such that it implements a custom form object."

I say that you have learned more than the author intended you to with this excersise in the book :o)
0
 
Thunder_screamAuthor Commented:
ok let me just ask you what is a custom form to you?
0
 
mrichmonCommented:
To me a custom form is a form that I have customized by putting fields, images, buttons, colors, etc on to suit my needs.
0
 
Thunder_screamAuthor Commented:
Thanks for the help and patience
0
 
mrichmonCommented:
No problem :o)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now