[Solved] C# method signatures – restricting types – what’s the correct terminology? [closed]

I think the term you are looking for is generic type constraints. From the linked MSDN article: When you define a generic class, you can apply restrictions to the kinds of types that client code can use for type arguments when it instantiates your class. If client code tries to instantiate your class by using … Read more

[Solved] What is the purpose of set here? [closed]

I think that set_nume is a member function of the class that sets data member nume of the class (of an object of the class) to the value of local variable nume(that is entered by the user) passed as an argument of the function. Maybe this member function does some checks of the validaty of … Read more

[Solved] Use variable in different class [duplicate]

You’re defining the variable entry inside the body of a method, this does not make entry accessible to the global scope, this is how you should embed objects: class Page1(Page): def __init__(self, *args, **kwargs): Page.__init__(self, *args, **kwargs) self.label = tk.Label(self, text=”This is page 1″) self.label.pack(side=”top”, fill=”both”, expand=True) self.entry = tk.Entry(self) self.entry.pack() As you can see, … Read more

[Solved] What is more Efficient? Implementation in overloaded function or by checking object type in Base class function

For many reasons – code maintainability, extensibility, concision, reliability, minimising the amount of code that needs to be recompiled/redistributed to pick up changes in some library code it uses – you should almost always use virtual functions rather that writing your own switching mechanisms. If you need to ask about it on stackoverflow, I’d go … Read more

[Solved] PHP: Property visibilty, static, etc [closed]

static means the value is accessed via self::$var instead of $this->var, is not instance-specific (i.e. it’s also available in static methods) and thus ideal for singletons and similar patterns a public var is accessible from everywhere, i.e. both from inside the class and outside a protected var is only accessible from inside the class and … Read more

[Solved] How to access an object (already cast as its parent) as its actual object without reflection?

You don’t have to use reflection at all. If you understand what type it is you like, you can use instanceof to get the specific class instance you care about. for(WordCategories.Noun n: nouns) { if(n instanceof WordCategories.Person) { // cast to WordCategories.Person and perform whatever action you like WordCategoriesPerson actualPerson = (WordCategories.Person) n; } } … Read more

[Solved] How do I access list inside an object [closed]

OP, this code makes me want to weep for little children, but the reason you’re getting errors is because you’re placing 4 separate variables in MessageBox.Show() call and not tying them together. Update Based on your comment, when I try to type oH_N1_N1.ListH_N1_N2, there is no N201_Name01 and N201_Name02 That’s because oH_N1_N1.ListH_N1_N2 is a List<H_N1_N2> … Read more

[Solved] Open Visual Studio 2008 Solution in Visual Studio 2013 without Upgrading

As several of the commenters have already helpfully pointed out, this is not possible. Round-tripping (i.e., opening and manipulating project files created by an older version of Visual Studio in a newer version of Visual Studio) was not supported until Visual Studio 11. The only way to open a Visual Studio 2008 project/solution in a … Read more

[Solved] Polymorphic object creation without IF condition

You want to make collection of records, by string code of object type, and parameters. One of many way to do it – use builder. Firstly we need to configurate builder: var builder = new RecordBuilder() .RegisterBuilder(“document”, (source, value) => new Document(source, value)) .RegisterBuilder(“headlines”, (source, value) => new Headlines(source, value)); here we specify how to … Read more

[Solved] What is a “public” keyword , is it a type?

public is really just an access modifier used, as you already know, on classes, fields etc. The var keyword on the other hand is a shortcut for “whatever type the statement on the right returns”. This is really just compiler candy, as it will be resolved to a concrete type (e.g. Int32) during compilation. EDIT: … Read more