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 837
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: Wimpie van Lingen |
last post by:
Hey
I have some more questions with regards to Remoting in .NET 2. I'm using TCP with the Binary formatter.
My solution consists of 4 projects:
- Class Library containing the server classes...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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: 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...
| |