Search Results

Search found 45620 results on 1825 pages for 'derived class'.

Page 6/1825 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • jQuery how to add class to a parent div which has a 3rd level child div with a specific class name.

    - by Vikram
    Hello friends I have an issue adding a special class to a couple of my divs. My layout is like this. <div class="container"> <div class="grid-6 push-3 equal" style="height: 999px;"> <div class="block"> <div id="mainbody"> <!-- Body content here --> </div> </div> </div> <div class="grid-2 equal" style="height: 999px;"> <div class="block"> <div id="sidebar-a"> <!-- Sidebar-a content here --> </div> </div> </div> <div class="grid-2 equal" style="height: 999px;"> <div class="block"> <div id="sidebar-b"> <!-- Sidebar-b content here --> </div> </div> </div> <div class="grid-2 equal" style="height: 999px;"> <div class="block"> <div id="sidebar-b"> <!-- Sidebar-c content here --> </div> </div> </div> </div> I want to add a different background color to each of my sidebars via CSS and when I code like: #mainbody { background : #fff; } #sidebar-a { background : #eee; } #sidebar-b { background : #ddd; } #sidebar-c { background : #ccc; } It is applying the background only to that specific class but that specific class is not of equal height. I actually need to apply to this <div class="grid-2 equal" style="height: 999px;"> div. Now the issue is that in this <div class="grid-6 push-3 equal" style="height: 999px;"> and class="grid-2 equal" style="height: 999px;"> the class names grid-6 and grid-2 are generated dynamically by my PHP of 960 Grid System and also the style="height: 999px; is generated by a jQuery script for Equal-Columns. What I want is to add a unique class name like this...... Look for a div with a class of .equal which has a child div with a class of .block and which further has a child div with an ID of sidebar-a. IF TRUE then add a class of .sidebar-a to the maindiv which has a class of .equal So that the result looks like this: <div class="grid-6 equal push-3 mainbody" style="height: 999px;"> <div class="grid-2 equal sidebar-a" style="height: 999px;"> <div class="grid-2 equal sidebar-b" style="height: 999px;"> <div class="grid-2 equal sidebar-c" style="height: 999px;"> Then I'll be able to style it like this: .mainbody { background : #fff; } .sidebar-a { background : #eee; } .sidebar-b { background : #ddd; } .sidebar-c { background : #ccc; } Hence I thought since I am anyway using jQuery in my Template, why not use it to deal with this issue. Please feel free to suggest a better way if you have something else in mind.

    Read the article

  • Why is an anonymous inner class containing nothing generated from this code?

    - by Andrew Westberg
    When run through javac on the cmd line Sun JVM 1.6.0_20, this code produces 6 .class files OuterClass.class OuterClass$1.class OuterClass$InnerClass.class OuterClass$InnerClass2.class OuterClass$InnerClass$InnerInnerClass.class OuterClass$PrivateInnerClass.class When run through JDT in eclipse, it produces only 5 classes. OuterClass.class OuterClass$1.class OuterClass$InnerClass.class OuterClass$InnerClass2.class OuterClass$InnerClass$InnerInnerClass.class OuterClass$PrivateInnerClass.class When decompiled, OuterClass$1.class contains nothing. Where is this extra class coming from and why is it created? package com.test; public class OuterClass { public class InnerClass { public class InnerInnerClass { } } public class InnerClass2 { } //this class should not exist in OuterClass after dummifying private class PrivateInnerClass { private String getString() { return "hello PrivateInnerClass"; } } public String getStringFromPrivateInner() { return new PrivateInnerClass().getString(); } }

    Read the article

  • Class Loading Deadlocks

    - by tomas.nilsson
    Mattis follows up on his previous post with one more expose on Class Loading Deadlocks As I wrote in a previous post, the class loading mechanism in Java is very powerful. There are many advanced techniques you can use, and when used wrongly you can get into all sorts of trouble. But one of the sneakiest deadlocks you can run into when it comes to class loading doesn't require any home made class loaders or anything. All you need is classes depending on each other, and some bad luck. First of all, here are some basic facts about class loading: 1) If a thread needs to use a class that is not yet loaded, it will try to load that class 2) If another thread is already loading the class, the first thread will wait for the other thread to finish the loading 3) During the loading of a class, one thing that happens is that the <clinit method of a class is being run 4) The <clinit method initializes all static fields, and runs any static blocks in the class. Take the following class for example: class Foo { static Bar bar = new Bar(); static { System.out.println("Loading Foo"); } } The first time a thread needs to use the Foo class, the class will be initialized. The <clinit method will run, creating a new Bar object and printing "Loading Foo" But what happens if the Bar object has never been used before either? Well, then we will need to load that class as well, calling the Bar <clinit method as we go. Can you start to see the potential problem here? A hint is in fact #2 above. What if another thread is currently loading class Bar? The thread loading class Foo will have to wait for that thread to finish loading. But what happens if the <clinit method of class Bar tries to initialize a Foo object? That thread will have to wait for the first thread, and there we have the deadlock. Thread one is waiting for thread two to initialize class Bar, thread two is waiting for thread one to initialize class Foo. All that is needed for a class loading deadlock is static cross dependencies between two classes (and a multi threaded environment): class Foo { static Bar b = new Bar(); } class Bar { static Foo f = new Foo(); } If two threads cause these classes to be loaded at exactly the same time, we will have a deadlock. So, how do you avoid this? Well, one way is of course to not have these circular (static) dependencies. On the other hand, it can be very hard to detect these, and sometimes your design may depend on it. What you can do in that case is to make sure that the classes are first loaded single threadedly, for example during an initialization phase of your application. The following program shows this kind of deadlock. To help bad luck on the way, I added a one second sleep in the static block of the classes to trigger the unlucky timing. Notice that if you uncomment the "//Foo f = new Foo();" line in the main method, the class will be loaded single threadedly, and the program will terminate as it should. public class ClassLoadingDeadlock { // Start two threads. The first will instansiate a Foo object, // the second one will instansiate a Bar object. public static void main(String[] arg) { // Uncomment next line to stop the deadlock // Foo f = new Foo(); new Thread(new FooUser()).start(); new Thread(new BarUser()).start(); } } class FooUser implements Runnable { public void run() { System.out.println("FooUser causing class Foo to be loaded"); Foo f = new Foo(); System.out.println("FooUser done"); } } class BarUser implements Runnable { public void run() { System.out.println("BarUser causing class Bar to be loaded"); Bar b = new Bar(); System.out.println("BarUser done"); } } class Foo { static { // We are deadlock prone even without this sleep... // The sleep just makes us more deterministic try { Thread.sleep(1000); } catch(InterruptedException e) {} } static Bar b = new Bar(); } class Bar { static { try { Thread.sleep(1000); } catch(InterruptedException e) {} } static Foo f = new Foo(); }

    Read the article

  • should I extend or create instance of the class

    - by meWantToLearn
    I have two classes Class A and Class B in Class A, i have three methods that perform the save, delete and select operation based upon the object I pass them. in Class B I perform the logic operations, such as modification to the property of the object before being passed to the methods of Class A, My problem is in Class B, should it extend Class A, and call the methods of class A , by parent::methodName or create instance of class A and then call Class A does not includes any property just methods. class A{ public function save($obj){ //code here } public function delete($obj){ //code here } public function select($obj){ //code here } } //Should I extend class A, and call the method by parent::methodName($obj) or create an instance of class A, call the method $instanceOfA-methodName($obj); class B extends A{ public function checkIfHasSaved($obj){ if($obj->saved == 'Yes'){ parent::save($obj); //**should I call the method like this** $instanceOFA = new A(); //**or create instance of class A and call without extending class A** instanceOFA->save($obj); } //other logic operations here } }

    Read the article

  • Changing multiple objects with a new class name using Jquery

    - by liquilife
    I'd like to click on a trigger and show a specific image. There are multiple triggers which would show a specific image related to it within a set. There are 4 sets The challenge for me is toggling the other images to hide only in this 'set' when one of these triggers are clicked, as there can only be one image showing at a time in each set. Here is the HTML I've put together thus far: <!-- Thumbnails which can be clicked on to toggle the larger preview image --> <div class="materials"> <a href="javascript:;" id="shirtgrey"><img src="/grey_shirt.png" height="122" width="122" /></a> <a href="javascript:;" id="shirtred"><img src="red_shirt.png" height="122" width="122" /></a> <a href="javascript:;" id="shirtblue"><img src="hblue_shirt.png" height="122" width="122" /></a> <a href="javascript:;" id="shirtgreen"><img src="green_shirt.png" height="122" width="122" /></a> </div> <div class="collars"> <a href="javascript:;" id="collargrey"><img src="grey_collar.png" height="122" width="122" /></a> <a href="javascript:;" id="collarred"><img src="red_collar.png" height="122" width="122" /></a> <a href="javascript:;" id="collarblue"><img src="blue_collar.png" height="122" width="122" /></a> <a href="javascript:;" id="collargreen"><img src="green_collar.png" height="122" width="122" /></a> </div> <div class="cuffs"> <a href="javascript:;" id="cuffgrey"><img src="grey_cuff.png" height="122" width="122" /></a> <a href="javascript:;" id="cuffred"><img src="red_cuff.png" height="122" width="122" /></a> <a href="javascript:;" id="cuffblue"><img src="blue_cuff.png" height="122" width="122" /></a> <a href="javascript:;" id="cuffgreen"><img src="/green_cuff.png" height="122" width="122" /></a> </div> <div class="pockets"> <a href="javascript:;" id="pocketgrey"><img src="grey_pocket.png" height="122" width="122" /></a> <a href="javascript:;" id="pocketred"><img src=".png" height="122" width="122" /></a> <a href="javascript:;" id="pocketblue"><img src="blue_pocket.png" height="122" width="122" /></a> <a href="javascript:;" id="pocketgreen"><img src="green_pocket.png" height="122" width="122" /></a> </div> <!-- The larger images where one from each set should be viewable at one time, triggered by the thumb clicked above --> <div class="selectionimg"> <div class="selectShirt"> <img src="grey_shirt.png" height="250" width="250" class="selectShirtGrey show" /> <img src="red_shirt.png" height="250" width="250" class="selectShirtRed hide" /> <img src="blue_shirt.png" height="250" width="250" class="selectShirtBlue hide" /> <img src="green_shirt.png" height="250" width="250" class="selectShirtGreen hide" /> </div> <div class="selectCollar"> <img src="grey_collar.png" height="250" width="250" class="selectCollarGrey show" /> <img src="red_collar.png" height="250" width="250" class="selectCollarRed hide" /> <img src="blue_collar.png" height="250" width="250" class="selectCollarBlue hide" /> <img src="green_collar.png" height="250" width="250" class="selectCollarGreen hide" /> </div> <div class="selectCuff"> <img src="grey_cuff.png" height="250" width="250" class="selectCuffGrey show" /> <img src="red_cuff.png" height="250" width="250" class="selectCuffRed hide" /> <img src="blue_cuff.png" height="250" width="250" class="selectCuffBlue hide" /> <img src="green_cuff.png" height="250" width="250" class="selectCuffGreen hide" /> </div> <div class="selectPocket"> <img src="grey_pocket.png" height="250" width="250" class="selectPocketGrey show" /> <img src="hred_pocket.png" height="250" width="250" class="selectPocketRed hide" /> <img src="blue_pocket.png" height="250" width="250" class="selectPocketBlue hide" /> <img src="green_pocket.png" height="250" width="250" class="selectPocketGreen hide" /> </div> </div> How can jQuery be used to change a class of an image to "show" and ensure that all other images in that same div are set to a class of "hide"? First time posting here. I'm very efficient with HTML and CSS and have a basic understanding of jQuery. I'm learning and this just seems a little bit beyond my abilities at the moment. I hope this all makes sense. Thanks for any help.

    Read the article

  • Getting an object from a 2d array inside of a class

    - by user36324
    I am have a class file that contains two classes, platform and platforms. platform holds the single platform information, and platforms has an 2d array of platforms. Im trying to render all of them in a for loop but it is not working. If you could kindly help me i would greatly appreciate. void Platforms::setUp() { for(int x = 0; x < tilesW; x++){ for(int y = 0; y < tilesH; y++){ Platform tempPlat(x,y,true,renderer,filename,tileSize/scaleW,tileSize/scaleH); platArray[x][y] = tempPlat; } } } void Platforms::show() { for(int x = 0; x < tilesW; x++){ for(int y = 0; y < tilesH; y++){ platArray[x][y].show(renderer,scaleW,scaleH); } } }

    Read the article

  • cast operator to base class within a thin wrapper derived class

    - by miked
    I have a derived class that's a very thin wrapper around a base class. Basically, I have a class that has two ways that it can be compared depending on how you interpret it so I created a new class that derives from the base class and only has new constructors (that just delegate to the base class) and a new operator==. What I'd like to do is overload the operator Base&() in the Derived class so in cases where I need to interpret it as the Base. For example: class Base { Base(stuff); Base(const Base& that); bool operator==(Base& rhs); //typical equality test }; class Derived : public Base { Derived(stuff) : Base(stuff) {}; Derived(const Base& that) : Base(that) {}; Derived(const Derived& that) : Base(that) {}; bool operator==(Derived& rhs); //special case equality test operator Base&() { return (Base&)*this; //Is this OK? It seems wrong to me. } }; If you want a simple example of what I'm trying to do, pretend I had a String class and String==String is the typical character by character comparison. But I created a new class CaseInsensitiveString that did a case insensitive compare on CaseInsensitiveString==CaseInsensitiveString but in all other cases just behaved like a String. it doesn't even have any new data members, just an overloaded operator==. (Please, don't tell me to use std::string, this is just an example!) Am I going about this right? Something seems fishy, but I can't put my finger on it.

    Read the article

  • Static class vs Singleton class in C# [closed]

    - by Floradu88
    Possible Duplicate: What is the difference between all-static-methods and applying a singleton pattern? I need to make a decision for a project I'm working of whether to use static or singleton. After reading an article like this I am inclined to use singleton. What is better to use static class or singleton? Edit 1 : Client Server Desktop Application. Please provide code oriented solutions.

    Read the article

  • jQuery only firing last class in multiple-class click

    - by user1134644
    I have a set of links like so: <a href="#internalLink1" class="classA">This has Class A</a> <a href="#internalLink2" class="classB">This has Class B</a> <a href="#internalLink3" class="classA classB">This has Class A and Class B</a> And here's the corresponding jQuery: $('.classA').click(function(){ // do class A stuff }); $('.classB').click(function(){ // do class B stuff }); Currently, when I click on the first link with Class A, it does the Class A stuff like it's supposed to. Similarly, when I click on the second link with Class B, it does the Class B stuff like it's supposed to. No worries there. My issue is, when I click on the third link with BOTH classes, it only fires the function for whichever class comes last (in this case, class B. If I put class A at the end instead, it performs class A's function). I want it to fire both. What am I doing wrong? Thanks in advance. EDIT: To those posting fiddles, nearly all of them work, so as many have said, it's most likely not my code, but the way it displays in my file. For a little more clarification, I was teaching myself some jQuery and decided to try making a (very) simple "Choose Your Own Adventure" type game. Here's a jsfiddle containing the opening of my bare-bones-please-don't-laugh game. Click on "Hide in the bushes", then "Examine the victim", then "Take any valuables and leave, he's dead already" <-- THIS is where the issue is. It's supposed to add 98 gold ("hawks") to your inventory, AND tell you that your alignment has shifted 1 point towards Chaotic. At the moment, it only does the chaotic alert, and no gold gets added to your inventory. The other option (refresh the fiddle to restart) that adds money to your inventory, but DOES NOT make you chaotic, works just fine (if you select "Search him for identification" instead of "take the money and run") Sorry this is so long!

    Read the article

  • Python metaclass to run a class method automatically on derived class

    - by Barry Steyn
    I want to automatically run a class method defined in a base class on any derived class during the creation of the class. For instance: class Base(object): @classmethod def runme(): print "I am being run" def __metclass__(cls,parents,attributes): clsObj = type(cls,parents,attributes) clsObj.runme() return clsObj class Derived(Base): pass: What happens here is that when Base is created, ''runme()'' will fire. But nothing happens when Derived is created. The question is: How can I make ''runme()'' also fire when creating Derived. This is what I have thought so far: If I explicitly set Derived's metclass to Base's, it will work. But I don't want that to happen. I basically want Derived to use the Base's metaclass without me having to explicitly set it so.

    Read the article

  • Hints to properly design UML class diagram

    - by mic4ael
    Here is the problem. I have just started learning UML and that is why I would like to ask for a few cues from experienced users how I could improve my diagram because I do know it lacks a lot of details, it has mistakes for sure etc. Renovation company hires workers. Each employee has some kind of profession, which is required to work on a particular position. Workers work in groups consisting of at most 15 members - so called production units, which specializes in a specified kind of work. Each production unit is managed by a foreman. Every worker in order to be able to perform job tasks needs proper accessories. There are two kind of tools - light and heavy. To use heavy tools, a worker must have proper privileges. A worker can have at most 3 light tools taken from the warehouse.

    Read the article

  • Isn't class scope purely for organization?

    - by Di-0xide
    Isn't scope just a way to organize classes, preventing outside code from accessing certain things you don't want accessed? More specifically, is there any functional gain to having public, protected, or private-scoped methods? Is there any advantage to classifying method/property scope rather than to, say, just public-ize everything? My presumption says no simply because, in binary code, there is no sense of scope (other than r/w/e, which isn't really scope at all, but rather global permissions for a block of memory). Is this correct? What about in languages like Java and C#[.NET]?

    Read the article

  • What class structure allows for a base class and mix/match of subclasses? (Similar to Users w/ roles)

    - by cdeszaq
    I have a set of base characteristics, and then a number of sub-types. Each instance must be one of the sub-types, but can be multiple sub-types at once. The sub-types of each thing can change. In general, I don't care what subtype I have, but sometimes I do care. This is much like a Users-Roles sort of relationship where a User having a particular Role gives the user additional characteristics. Sort of like duck-typing (ie. If my Foo has a Bar, I can treat it like a ThingWithABar.) Straight inheritance doesn't work, since that doesn't allow mix/match of sub-types. (ie. no multi-inheritance). Straight composition doesn't work because I can't switch that up at runtime. How can I model this?

    Read the article

  • Extract derived 3D scaling from a 3D Sprite to set to a 2D billboard

    - by Bill Kotsias
    I am trying to get the derived position and scaling of a 3D Sprite and set them to a 2D Sprite. I have managed to do the first part like this: var p:Point = sprite3d.local3DToGlobal(new Vector3D(0,0,0)); billboard.x = p.x; billboard.y = p.y; But I can't get the scaling part correctly. I am trying this: var mat:Matrix3D = sprite3d.transform.getRelativeMatrix3D(stage); // get derived matrix(?) var scaleV:Vector3D = mat.decompose()[2]; // get scaling vector from derived matrix var scale:Number = scaleV.length; billboard.scaleX = scale; billboard.scaleY = scale; ...but the result is apparently wrong. PS. One might ask what I am trying to achieve. I am trying to create "billboard" 3D sprites, i.e. sprites which are affected by all 3D transformations except rotations, thus they always face the "camera".

    Read the article

  • how can i select first second or third element with given class name using CSS?

    - by Tumharyyaaden
    ie. i have the following: <div class="myclass">my text1</div> some other code+containers... <div class="myclass">my text2</div> some other code+containers... <div class="myclass">my text3</div> some other code+containers... i have the css class div.myclass {doing things} that applies to all obviously but i also wanted to be able to select the first, second or third like this: div.myclass:first {color:#000;} div.myclass:second {color:#FFF;} div.myclass:third {color:#006;} almost like the jQuery index selection .eq( index ) which is what i am using currently but need a noscript alternative. Thanks in advance!

    Read the article

  • Accessing every child class of parent class in Java

    - by darkie15
    Hi All, I have to implement a logic whereby given a child class, I need to access its parent class and all other child class of that parent class, if any. I did not find any API in Java Reflection which allows us to access all child classes of a parent class. Is there any way to do it? Ex. class B extends class A class C extends class A Now using class B, I can find the superclass by calling getSuperClass(). But is there any way to find all the child classes once I have the parent class i.e. class B and class C?? Regards, darkie

    Read the article

  • Some confusion with a class variable, but with a twist...

    - by Omega
    I have a class called MyPackage.WebServer and it has a property called DBEngine. I am also dynamically loading a module and class using load_module. Inside this class, it attempts to reference MyPackage.WebServer. When it does though, DBEngine is not set to the value given when WebServer is instantiated. It's the default (None). Would the fact that I'm using load_module cause a different object graph to be created and thus isolate my dynamically loaded class from the rest of my python app?

    Read the article

  • Can I make a derived class inherit a derived member from its base class in Java?

    - by Eric
    I have code that looks like this: public class A { public void doStuff() { System.out.print("Stuff successfully done"); } } public class B extends A { public void doStuff() { System.out.print("Stuff successfully done, but in a different way"); } public void doMoreStuff() { System.out.print("More advanced stuff successully done"); } } public class AWrapper { public A member; public AWrapper(A member) { this.member = member; } public void doStuffWithMember() { a.doStuff(); } } public class BWrapper extends AWrapper { public B member; public BWrapper(B member) { super(member); //Pointer to member stored in two places: this.member = member; //Not great if one changes, but the other does not } public void doStuffWithMember() { member.doMoreStuff(); } } However, there is a problem with this code. I'm storing a reference to the member in two places, but if one changes and the other does not, there could be trouble. I know that in Java, an inherited method can narrow down its return type (and perhaps arguments, but I'm not certain) to a derived class. Is the same true of fields?

    Read the article

  • "Public" nested classes or not

    - by Frederick
    Suppose I have a class 'Application'. In order to be initialised it takes certain settings in the constructor. Let's also assume that the number of settings is so many that it's compelling to place them in a class of their own. Compare the following two implementations of this scenario. Implementation 1: class Application { Application(ApplicationSettings settings) { //Do initialisation here } } class ApplicationSettings { //Settings related methods and properties here } Implementation 2: class Application { Application(Application.Settings settings) { //Do initialisation here } class Settings { //Settings related methods and properties here } } To me, the second approach is very much preferable. It is more readable because it strongly emphasises the relation between the two classes. When I write code to instantiate Application class anywhere, the second approach is going to look prettier. Now just imagine the Settings class itself in turn had some similarly "related" class and that class in turn did so too. Go only three such levels and the class naming gets out out of hand in the 'non-nested' case. If you nest, however, things still stay elegant. Despite the above, I've read people saying on StackOverflow that nested classes are justified only if they're not visible to the outside world; that is if they are used only for the internal implementation of the containing class. The commonly cited objection is bloating the size of containing class's source file, but partial classes is the perfect solution for that problem. My question is, why are we wary of the "publicly exposed" use of nested classes? Are there any other arguments against such use?

    Read the article

  • Figuring out what makes a C++ class abstract in VS2008

    - by suszterpatt
    I'm using VS2008 to build a plain old C++ program (not C++/CLI). I have an abstract base class and a non-abstract derived class, and building this: Base* obj; obj = new Derived(); fails with the error "'Derived': cannot instantiate abstract class". (It may be worth noting, however, that if I hover over Base with the cursor, VS will pop up a tooltip saying "class Base abstract", but hovering over Derived will only say "class Derived" (no "abstract")). The definitions of these classes are fairly large and I'd like to avoid manually checking if each method has been overridden. Can VS do this for me somehow? Any general tips on pinpointing the exact parts of the class' definition that make it abstract?

    Read the article

  • Is It "Wrong"/Bad Design To Put A Thread/Background Worker In A Class?

    - by Jetti
    I have a class that will read from Excel (C# and .Net 4) and in that class I have a background worker that will load the data from Excel while the UI can remain responsive. My question is as follows: Is it bad design to have a background worker in a class? Should I create my class without it and use a background worker to operate on that class? I can't see any issues really of creating my class this way but then again I am a newbie so I figured I would make sure before I continue on. I hope that this question is relevant here as I don't think it should be on stackoverflow as my code works, this just a design issue.

    Read the article

  • VB.NET class inherits a base class and implements an interface issue (works in C#)

    - by 300 baud
    I am trying to create a class in VB.NET which inherits a base abstract class and also implements an interface. The interface declares a string property called Description. The base class contains a string property called Description. The main class inherits the base class and implements the interface. The existence of the Description property in the base class fulfills the interface requirements. This works fine in C# but causes issues in VB.NET. First, here is an example of the C# code which works: public interface IFoo { string Description { get; set; } } public abstract class FooBase { public string Description { get; set; } } public class MyFoo : FooBase, IFoo { } Now here is the VB.NET version which gives a compiler error: Public Interface IFoo Property Description() As String End Interface Public MustInherit Class FooBase Private _Description As String Public Property Description() As String Get Return _Description End Get Set(ByVal value As String) _Description = value End Set End Property End Class Public Class MyFoo Inherits FooBase Implements IFoo End Class If I make the base class (FooBase) implement the interface and add the Implements IFoo.Description to the property all is good, but I do not want the base class to implement the interface. The compiler error is: Class 'MyFoo' must implement 'Property Description() As String' for interface 'IFoo'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers. Can VB.NET not handle this, or do I need to change my syntax somewhere to get this to work?

    Read the article

  • Accessing parent class attribute from sub-class body

    - by warwaruk
    I have a class Klass with a class attribute my_list. I have a subclass of it SubKlass, in which i want to have a class attribute my_list which is a modified version of the same attribute from parent class: class Klass(): my_list = [1, 2, 3] class SubKlass(Klass): my_list = Klass.my_list + [4, 5] # this works, but i must specify parent class explicitly #my_list = super().my_list + [4, 5] # SystemError: super(): __class__ cell not found #my_list = my_list + [4, 5] # NameError: name 'my_list' is not defined print(Klass.my_list) print(SubKlass.my_list) So, is there a way to access parent class attribute without specifying its name?

    Read the article

  • How to get actual type of an derived class from its parent interface

    - by Tarik
    Hello people, Lets say we have a code portion like this : IProduct product = ProductCreator.CreateProduct(); //Factory Method we have here SellThisProduct(product); //... private void SellThisProduct(IProduct product) { //..do something here } //... internal class Soda : IProduct {} internal class Book : IProduct {} How can I infer which product is actually passed into SellThisProduct() method in the method? I think if I say GetType() or something it will probably return the IProduct type. Thanks...

    Read the article

  • Objective-C Class Question?

    - by tarnfeld
    Hey, My head is about to explode with this logic, can anyone help? Class A #imports Class B. Class A calls Method A in Class B. This works great Class B wants to send a response back to Class A from another method that is called from Method A. If you #import Class A from Class B, it is in effect an infinite loop and the whole thing crashes. Is there a way to do this properly, like a parent type thing? BTW, I'm developing for iPhone.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >