Protected Means, we can access this member only in a deriving class, and internal means we can access this member in any type in the same assembly using a object.
So can I consider a Protected Internal member as a public member in the same assembly. and as a protected member in the different assembly.
EDIT:
namespace pracConsole
{
...
I have a class which have a static member. As I understand all static members are common for all instance of the class. So it means static members would get memory only once. Where is this memory is allocated (Stack or Heap) and when this memory get allocated.
EDIT: This memory is different from a instance level memory. How this memory ...
Possible Duplicate:
Namespace only class visibility in C#/.NET ?
What I want is to have a class that is only accessible to other classes inside the same namespace without having to put the namespace in it's own assembly.
Is there a reason this is not possible in C#?
Edit: I have change the question a little, since the compi...
I'm wondering if I should change the software architecture of one of my projects.
I'm developing software for a project where two sides (in fact a host and a device) use shared code. That helps because shared data, e.g. enums can be stored in one central place.
I'm working with what we call a "channel" to transfer data between device a...
Its a well known fact that a static method can work only on static members.
public static void Main()
{
Test t1 = new Test();
}
Here the Main method is static, but I haven't declared t1 as static. Is it implicitly static?
...
I was surprised by the fact that Map<?,?> is not a Collection<?>.
I thought it'd make a LOT of sense if it was declared as such:
public interface Map<K,V> extends Collection<Map.Entry<K,V>>
After all, a Map<K,V> is a collection of Map.Entry<K,V>, isn't it?
So is there a good reason why it's not implemented as such?
Thanks to Clet...
In some sample codes there are methods and classes declared WITHIN other methods and/or classes.
I've never heard/read about this. What effect does this kind of programming have? Wouldn't it be better to write down classes in a seperate file and methods side by side and not within each other (like every book tells you)? What are the adv...
I have an NSMutableArray. It's members eventually become members of an array instance in a class. I want to put the instantiantion of NSMutable into a function and to return an array object. If I can do this, I can make some of my code easier to read. Is this possible?
Here is what I am trying to figure out.
//Definition:
function Obje...
Hello,
So I have a very simple class that has a method called getThumbUrl() but when I try calling this method on an instance I get
Notice: Undefined property: FlickrImage::$getThumbUrl
But it is clearly there. Here is the code of the function inside of the FlickrImage class:
public function getThumbUrl()
{
return "http://farm"....
Example:
// access fields directly
private void doThis()
{
return doSomeWork(this.data);
}
// receive data as an argument
private void doThis(data)
{
return doSomeWork(data);
}
The first option is coupled to the value in this.data while the second option avoids this coupling. I feel like the second option is always better. It...
I do Java programming and recently started learning Python via the official documentation.
I see that we can dynamically add data attributes to an instance object unlike in Java:
class House:
pass
my_house = House()
my_house.number = 40
my_house.rooms = 8
my_house.garden = 1
My question is, in what situations is this feature used?...
Not sure where to start, so I'm just going to plow in. Let's say I'm trying to represent an economy in OOP. A basic design I've come up with is:
class Person{
int $money; // Money someone has in wallet/purse
int $bank_account_id;
function getAmountOfMoney()
function addMoney($amountToAdd)
function subtractMoney($amountToSubtr...
Hello
Is it possible to call functions from class like this:
$class = new class;
$function_name = "do_the_thing";
$req = $class->$function_name();
Something similar solution, this doesn't seem to work?
Martti Laine
...
public class MyController
{
public object CreateByEnum(DataModelType modeltype)
{
string enumText = modeltype.ToString(); // will return for example "Company"
Type classType = Type.GetType(enumText); // the Type for Company class
object t = Activator.CreateInstance(classType); // ...
Is there a metric that can assist in determining the object-orientedness of a system or application? I've seen some pretty neat metrics in the .NET Reflector Add-ins codeplex project, but nothing like this yet. If such a metric doesn't exist, would it even be possible or useful? There are the 3 supposed tenets of object-oriented programm...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace EfTestFactory
{
public abstract class _Company
{
public abstract List<Personel> GetPersonel();
public abstract List<Prim> GetPrim();
public abstract List<Finans> GetFinans();
}
public abstract class _...
I know very well about the traditional arguments about why Interface Inheritance is prefered to multiple inheritance, there has been already a post here :
http://stackoverflow.com/questions/191691/should-c-include-multiple-inheritance
But according to Stroustrup the real reason why Microsoft and Sun decided to get rid off multiple inher...
If we define a property as public property and in this property we have a protected getter. what does it means? if property is public, what does defining a protected getter for that, means?
please see below code:
public ISessionFactory SessionFactory
{
protected get { return sessionFactory; }
set { sessionFactory...
We all know the infamous "cannot redeclare class" error. Is there any method to overcome this and actually declare a new class with the same name, or is this impossible in PHP 5?
...
Given I have a class with two constructors:
public class TestClass {
ObjectOne o1;
ObjectTwo o2;
public TestClass(ObjectOne o1) {
// ..
}
public TestClass(ObjectTwo o2) {
// ..
}
}
Please assume, that ObjectOne is an interface type, and ObjectTwo implements ObjectOne. What happens, if I call:
...