473,473 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Override method with member



I want to name a variable in a form Move.

But Move() is a method, (Control.Move) that the form inherits.

Can I override a method and have a variable with the same name that I
can access publically?
Aug 16 '05 #1
3 1361
"John Bailo" <ja*****@texeme.com> wrote in message
news:MO********************@speakeasy.net...
I want to name a variable in a form Move.

But Move() is a method, (Control.Move) that the form inherits.

Can I override a method and have a variable with the same name that I
can access publically?


What happened when you tried it?

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton
Aug 17 '05 #2
Tim Haughton wrote:
"John Bailo" <ja*****@texeme.com> wrote in message
news:MO********************@speakeasy.net...
I want to name a variable in a form Move.

But Move() is a method, (Control.Move) that the form inherits.

Can I override a method and have a variable with the same name that I
can access publically?

What happened when you tried it?


Well, I couldn't figure out how.

I set a reference to a child form:

frmMove Move = new frmMove(parentForm);
Then when I tried to reference parentForm.Move in the Dispose() method,
it only referred to the Control.Move() method. So, I was wondering if
I could override the Control.Move() method so I could access the .Move
member.
Aug 17 '05 #3
The quick answer is no, you can't have a field with the exact same name as a
method.

--
Regards,

Tim Haughton

Agitek
http://agitek.co.uk
http://blogitek.com/timhaughton

"John Bailo" <ja*****@texeme.com> wrote in message
news:43**************@texeme.com...
Tim Haughton wrote:
"John Bailo" <ja*****@texeme.com> wrote in message
news:MO********************@speakeasy.net...
I want to name a variable in a form Move.

But Move() is a method, (Control.Move) that the form inherits.

Can I override a method and have a variable with the same name that I
can access publically?

What happened when you tried it?


Well, I couldn't figure out how.

I set a reference to a child form:

frmMove Move = new frmMove(parentForm);
Then when I tried to reference parentForm.Move in the Dispose() method,
it only referred to the Control.Move() method. So, I was wondering if
I could override the Control.Move() method so I could access the .Move
member.

Aug 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Eric Johannsen | last post by:
I have a simple object that inherits from CollectionBase and overrides the Count property: namespace MyTest { public class CollTest : System.Collections.CollectionBase { public override int...
5
by: Darius | last post by:
I'm writing here in hopes that someone can explain the difference between the new and virtual/override keywords in C#. Specifically, what is the difference between this: public class Window {...
11
by: songie D | last post by:
Does c# support overriding by name and not signature For instance I am building a custom collection class, that ca only take a certain type of object For this, I have added an override for add...
11
by: z_learning_tester | last post by:
Hello, yes another beginner question that I'm sure is obvious to many here :-) My book is so bad. Really. It uses the exact same example of code for using the new kw and for using virtual(in the...
3
by: John Bailo | last post by:
I want to name a variable in a form Move. But Move() is a method, (Control.Move) that the form inherits. Can I override a method and have a variable with the same name that I can access...
5
by: Marcel Hug | last post by:
Hi NG ! I'm new in C# and I'm reading a book about the fundamentals and concepts. In the chapter Methods it's written to use virtual, if i would like to override the method in a subclass. This...
5
by: taumuon | last post by:
I've got an object, Person, that supports IEquatable<Person>. It implements bool Equals(Person obj) as well as overriding bool Equals(object obj) I've got a container type that holds a member...
1
by: Tony Johansson | last post by:
Hello! I have three classes below. These are Animal as a base class and one derived class called Cat. The main in within class Tester. If I compile the program as it is now I get the...
5
by: Tony Johansson | last post by:
Hello! Here I have an Interface called ITest and a class called MyClass which derive this intrface. As you can see I don't implement this method myTest in class MyClass because i use the...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.