Sorry! I know these are basic, stupid questions, and I already knew the
answers to these, I swear, and I have used them countless times, I
swear, but at the moment I am fighting a bout of amnesia and it is
extremely important for me to know the answers just now.
Can an interface have:
1. a private field?
2. a public member variable instead of having a public property
declaration?
3. a public member variable initialized with some value? 6 946
sorry, please ignore. To get my memory back, I just tried this code
out. It took about five seconds. Got my answers. I am such a dick
sometimes.
1. a private field?
A: No
2. a public member variable instead of having a public property
declaration?
Ans: No
3. a public member variable initialized with some value?
Ans: No. It cannot even have a member.
Sorry again.
"Water Cooler v2" <wt*****@yahoo.com> skrev i en meddelelse
news:11**********************@u72g2000cwu.googlegr oups.com... sorry, please ignore. To get my memory back, I just tried this code out. It took about five seconds. Got my answers. I am such a dick sometimes.
Haha. You know, I'm exactly the same. Get stuck on some issue. Can't get
past it. Write a message to a newsgroup... and then you work it out yourself
two minutes later, and realise how lame the questions really were. :-)
Peter
To clearify the reason why it can't:
An interface is just a contract for classes to fulfill. An interface can
never contain any data or any code.
Water Cooler v2 wrote: sorry, please ignore. To get my memory back, I just tried this code out. It took about five seconds. Got my answers. I am such a dick sometimes.
1. a private field? A: No
2. a public member variable instead of having a public property declaration? Ans: No
3. a public member variable initialized with some value? Ans: No. It cannot even have a member.
Sorry again.
This is not entirely true ... an interface can techincally have a static
items associated with it (as a type) though this is not allowed in C# or any
other major language :)
Cheers,
Greg
"Göran Andersson" <gu***@guffa.com> wrote in message
news:eS**************@TK2MSFTNGP05.phx.gbl... To clearify the reason why it can't:
An interface is just a contract for classes to fulfill. An interface can never contain any data or any code.
Water Cooler v2 wrote: sorry, please ignore. To get my memory back, I just tried this code out. It took about five seconds. Got my answers. I am such a dick sometimes.
1. a private field? A: No
2. a public member variable instead of having a public property declaration? Ans: No
3. a public member variable initialized with some value? Ans: No. It cannot even have a member.
Sorry again.
How true. The psychological reason is clear. When you are banging away at a
problem, you get caught in a cycle. As soon as you get it off your plate,
your mind has a cleared path to actually solve the problem.
--
Gregory A. Beamer
*************************************************
Think Outside the Box!
*************************************************
"Peter Kirk" <pk@alpha-solutions.dk> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl... "Water Cooler v2" <wt*****@yahoo.com> skrev i en meddelelse news:11**********************@u72g2000cwu.googlegr oups.com... sorry, please ignore. To get my memory back, I just tried this code out. It took about five seconds. Got my answers. I am such a dick sometimes.
Haha. You know, I'm exactly the same. Get stuck on some issue. Can't get past it. Write a message to a newsgroup... and then you work it out yourself two minutes later, and realise how lame the questions really were. :-)
Peter
On Fri, 5 May 2006 06:21:57 -0400, "Greg Young"
<Dr*************@hotmail.com> wrote: This is not entirely true ... an interface can techincally have a static items associated with it (as a type) though this is not allowed in C# or any other major language :)
Greg, can you explain a bit more? I guess you are referring to
provisions for statics in generated IL code, but how would this work
in practice? I was just considering a related problem (how to
associate constants with an Interface) and thought that it was a
multiple-inheritance problem. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: randomblink |
last post by:
Alright...
Does anyone know if you can create a class that has a constructor?
I would like to create a BUTTONMANAGER class that handles my buttons
for me...
I am doing this in Access for those...
|
by: Gomaw Beoyr |
last post by:
Two question about the "partial classes" (in the next wersion of
..NET).
Question 1
==========
Will partial classes (in the next version of C#) have to be
declared "partial" in ALL places.
...
|
by: Phil D |
last post by:
Hi,
I am new to c# and oop and have a question about interfaces which I hope
someone can help me with.
The book I am using (C# Step by Step) explains how to create and implement
interfaces...
|
by: p988 |
last post by:
Learning C# is much tougher than I expected...Please help me by answering
the following questions! Thank you in advance!
1. Are all Enumerations type Value type?
2. The line,
RegistryKey...
|
by: Michael S |
last post by:
Why do people spend so much time writing complex generic types?
for fun?
to learn?
for use?
I think of generics like I do about operator overloading.
Great to have as a language-feature, as...
|
by: Water Cooler v2 |
last post by:
Sorry! I know these are basic, stupid questions, and I already knew the
answers to these, I swear, and I have used them countless times, I
swear, but at the moment I am fighting a bout of amnesia...
|
by: Schroeder, AJ |
last post by:
Hello group,
I am using snmprealwalk() to scan for interface types and descriptions on
some Cisco routers. What I am doing is two calls to walk the routers; one
walk for ifDescr.x and the other...
|
by: Rob |
last post by:
In order to create a date in CCYY-MM-DD fashion, I used to be able to use
the Format(date,"yyyy")&"-"&Format(month,"mm")... syntax...
This no longer appears to work in vb.net. I know how I...
|
by: shamirza |
last post by:
4 9 6
18.ATLAS-AJAX
Note: - As an IT professional it's useful to know what the difference
is between Hype and
usefulness. For instance if there is a new technology coming in many
programmers...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
| |