Search Results

Search found 45901 results on 1837 pages for 'class diagram'.

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

  • Base class -> Derived class and vice-versa conversions in C++

    - by Ivan Nikolaev
    Hi! I have the following example code: #include <iostream> #include <string> using namespace std; class Event { public: string type; string source; }; class KeyEvent : public Event { public: string key; string modifier; }; class MouseEvent : public Event { public: string button; int x; int y; }; void handleEvent(KeyEvent e) { if(e.key == "ENTER") cout << "Hello world! The Enter key was pressed ;)" << endl; } Event generateEvent() { KeyEvent e; e.type = "KEYBOARD_EVENT"; e.source = "Keyboard0"; e.key = "SPACEBAR"; e.modifier = "none"; return e; } int main() { KeyEvent e = generateEvent(); return 0; } I can't compile it, G++ throws an error of kind: main.cpp: In function 'int main()': main.cpp:47:29: error: conversion from 'Event' to non-scalar type 'KeyEvent' requested I know that the error is obvious for C++ guru's, but I can't understand why I can't do the conversion from base class object to derived one. Can someone suggest me the solution of the problem that I have? Thx in advice

    Read the article

  • creating class diagram vs2008

    - by jaymin
    Hi, i am currently working on a project using visual studio 2008, vc++. i want to view the class diagram of my code, but i dont see any "class diagram" option when i click add new item, please do help me.. thanks..

    Read the article

  • 'abstract class' versus 'normal class' for a reusable library

    - by Greg
    I'm developing a reusable library and have been creating abstract classes, so the client can then extend from these. QUESTION: Is there any reason in fact I should use an abstract class here as opposed to just a normal class? Note - Have already decided I do not want to use interfaces as I want to include actual default methods in my library so the client using it doesn't have to write the code.

    Read the article

  • Verification of UML Class Diagram

    - by Jean Carlos Suárez Marranzini
    This is my UML Class Diagram made in Astah Community, for a tennis scoreboard game. Here's a link to the image (I don't have enough rep to post images): http://i47.tinypic.com/2lsxx90.png Points are calculated based on moves. Moves can be either points (for the player's advantage) or errors (for the opponent's advantage). The Time Machine allows you to travel to previous game states (expressed as scoreboards). The storage component should be able to store matches independently of the serialization format. The serializers and deserializers should be able to do their job regardless of where the storage lies. The GameEngine should be able to apply the rules of the game regardless of the particularities of the game (hence, dependency injection through the Settings class). The outcomes of games, sets and matches should be deducible based on the points and the rules to apply (the logic implementations are there to provide the rules). Could you please verify my design and tell me if there's anything wrong with it? Thanks in advance.

    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

  • Nice network diagram editor?

    - by Nicolas Raoul
    Writing a commercial proposal, I want to create a nice graphic showing the clients the architecture I thought of for their IT network, with servers, network connections, firewall, load-balancing, etc. For years I have been using dia, but I am tired of it, the results are not satisfying, very few network elements are available, and each element's graphic representation is really ugly. Question: How to create nice network diagrams? If a better set of elements was available for dia, that would be a solution.

    Read the article

  • Nice network diagram editor?

    - by Nicolas Raoul
    Writing a commercial proposal, I want to create a nice graphic showing the clients the architecture I thought of for their IT network, with servers, network connections, firewall, load-balancing, etc. For years I have been using dia, but I am tired of it because: the results are not satisfying, very few network elements are available, and each element's graphic representation is really ugly. Question: How to create nice network diagrams? If a better set of elements was available for dia, that would be a solution.

    Read the article

  • How to depict Import a file action in the Sequence diagram

    - by user970696
    Everyone says sequence diagrams are so easy but I just cannot figure this out. Basically user clicks on an 'Import from temp folder' button, the program opens a window with a list populated with filenames, user clicks on a filename, clicks on OK and the document is imported. I know the order of the actions but how to depict e.g. populating a list, or selecting an item from a list? So I assume the objects would be like: [USER] [ImportDialogWindow] [ListOfFiles:STRING] [?where to go with selected file]

    Read the article

  • Java NetBeans Comments Class Diagram Helper

    - by ikurtz
    i am starting to learn Java using Netbeans 6.8 IDE. i am wondering if there is a utility in NetBeans similar to VS2008 that facilitates commenting code and later display these comments in class diagrams? thanks. EDIT: i found the Javadoc feature. it is some help but not that great.

    Read the article

  • Is there a tool to do round trip software engineering between a sequence diagram and a group of objects that message back and forth?

    - by DeveloperDon
    Is there a tool to do round trip software engineering between a sequence diagram and a group of objects that message back and forth? Perhaps this seems a little exotic, but it seems like a function that includes message calls or even method invocations on other objects could be automatically converted to a sequence diagram given that it is not hard to do manually. Similarly, when a sequence diagram is modified, based on the message name and type of message, should it not be possible to add a message or method to the calling object?

    Read the article

  • Abstract class + Inheritance vs Interface

    - by RealityDysfunction
    Hello fellow programmers, I am reading a book on C# and the author is comparing Abstract classes and Interfaces. He claims that if you have the following "abstract class:" abstract class CloneableType { public abstract object Clone(); } Then you cannot do this: public class MiniVan : Car, CloneableType {} This, I understand. However he claims that because of this inability to do multiple inheritance that you should use an interface for CloneableType, like so: public interface ICloneable { object Clone(); } My question is, isn't this somewhat misleading, because you can create an abstract class which is "above" class Car with the method Clone, then have Car inherit that class and then Minivan will inherit Car with all these methods, CloneAble class - Car class - Minivan Class. What do you think? Thanks.

    Read the article

  • Subclassing to avoid line length

    - by Super User
    The standard line length of code is 80 characters per line. This is accepted and followed by the most of programmers. I working on a state machine of a character and is necessary for me follow this too. I have four classes who pass this limit. I can subclass each class in two more and then avoid the line length limit. class Stand class Walk class Punch class Crouch The new classes would be StandLeft, StandRight and so on. Stand, Walk, Punch and Crouch would be then abstract classes. The question if there is a limit for the long of the hierarchies tree or this is depends of the case.

    Read the article

  • Why should I declare a class as an abstract class?

    - by Pied Piper
    I know the syntax, rules applied to abstract class and I want know usage of an abstract class Abstract class can not be instantiated directly but can be extended by other class What is the advantage of doing so? How it is different from an Interface? I know that one class can implement multiple interfaces but can only extend one abstract class. Is that only difference between an interface and an abstract class? I am aware about usage of an Interface. I have learned that from Event delegation model of AWT in Java. In which situations I should declare class as an abstract class? What is benefits of that?

    Read the article

  • Python: query a class's parent-class after multiple derivations ("super()" does not work)

    - by henry
    Hi, I have built a class-system that uses multiple derivations of a baseclass (object-class1-class2-class3): class class1(object): def __init__(self): print "class1.__init__()" object.__init__(self) class class2(class1): def __init__(self): print "class2.__init__()" class1.__init__(self) class class3(class2): def __init__(self): print "class3.__init__()" class2.__init__(self) x = class3() It works as expected and prints: class3.__init__() class2.__init__() class1.__init__() Now I would like to replace the 3 lines object.__init__(self) ... class1.__init__(self) ... class2.__init__(self) with something like this: currentParentClass().__init__() ... currentParentClass().__init__() ... currentParentClass().__init__() So basically, i want to create a class-system where i don't have to type "classXYZ.doSomething()". As mentioned above, I want to get the "current class's parent-class". Replacing the three lines with: super(type(self), self).__init__() does NOT work (it always returns the parent-class of the current instance - class2) and will result in an endless loop printing: class3.__init__() class2.__init__() class2.__init__() class2.__init__() class2.__init__() ... So is there a function that can give me the current class's parent-class? Thank you for your help! Henry -------------------- Edit: @Lennart ok maybe i got you wrong but at the moment i think i didn't describe the problem clearly enough.So this example might explain it better: lets create another child-class class class4(class3): pass now what happens if we derive an instance from class4? y = class4() i think it clearly executes: super(class3, self).__init__() which we can translate to this: class2.__init__(y) this is definitly not the goal(that would be class3.__init__(y)) Now making lots of parent-class-function-calls - i do not want to re-implement all of my functions with different base-class-names in my super()-calls.

    Read the article

  • How to use derived class shared variables in shared methods of base class

    - by KoolKabin
    Hi guys, I am trying to add shared members in derived classes and use that values in base classes... I have base class DBLayer public shared function GetDetail(byval UIN as integer) dim StrSql = string.format("select * from {0} where uin = {1}", tablename, uin) .... end function end class my derived class class User inherits dblayer public shared tabledname as string = "users" end class class item inherits dblayer public shared tabledname as string = "item" end class class category inherits dblayer public shared tabledname as string = "category" end class currently there is error using the tablename variable of derived class in base class but i want to use it... coz i dun know other techniques... if other solutions are better then u can post it or u can say how can i make it work? confused...

    Read the article

  • Advantages of Singleton Class over Static Class?

    Point 1)Singleton We can get the object of singleton and then pass to other methods.Static Class We can not pass static class to other methods as we pass objectsPoint 2) Singleton In future, it is easy to change the logic of of creating objects to some pooling mechanism. Static Class Very difficult to implement some pooling logic in case of static class. We would need to make that class as non-static and then make all the methods non-static methods, So entire your code needs to be changed.Point3:) Singleton Can Singletone class be inherited to subclass? Singleton class does not say any restriction of Inheritence. So we should be able to do this as long as subclass is also inheritence.There's nothing fundamentally wrong with subclassing a class that is intended to be a singleton. There are many reasons you might want to do it. and there are many ways to accomplish it. It depends on language you use.Static Class We can not inherit Static class to another Static class in C#. Think about it this way: you access static members via type name, like this: MyStaticType.MyStaticMember(); Were you to inherit from that class, you would have to access it via the new type name: MyNewType.MyStaticMember(); Thus, the new item bears no relationships to the original when used in code. There would be no way to take advantage of any inheritance relationship for things like polymorphism. span.fullpost {display:none;}

    Read the article

  • Advantages of Singleton Class over Static Class?

    Point 1) Singleton We can get the object of singleton and then pass to other methods. Static Class We can not pass static class to other methods as we pass objects Point 2) Singleton In future, it is easy to change the logic of of creating objects to some pooling mechanism. Static Class Very difficult to implement some pooling logic in case of static class. We would need to make that class as non-static and then make all the methods non-static methods, So entire your code needs to be changed. Point3:) Singleton Can Singletone class be inherited to subclass? Singleton class does not say any restriction of Inheritence. So we should be able to do this as long as subclass is also inheritence.There's nothing fundamentally wrong with subclassing a class that is intended to be a singleton. There are many reasons you might want to do it. and there are many ways to accomplish it. It depends on language you use. Static Class We can not inherit Static class to another Static class in C#. Think about it this way: you access static members via type name, like this: MyStaticType.MyStaticMember(); Were you to inherit from that class, you would have to access it via the new type name: MyNewType.MyStaticMember(); Thus, the new item bears no relationships to the original when used in code. There would be no way to take advantage of any inheritance relationship for things like polymorphism. span.fullpost {display:none;}

    Read the article

  • Differences between a conceptual UML class diagram and an ERD?

    - by Adam
    If I create a conceptual class diagram such that each class captures 'name' and 'attributes' but not 'operations', have I not basically created what would be otherwise considered an ERD? I'm trying to gain an understanding of what the differences are between creating a conceptual class diagram as I have described versus calling it a ERD? If these are still two different animals, can somebody please explain what the differences are?

    Read the article

  • Weird Excel bar diagram behaviour

    - by Simon
    Hi I have a very simple question. I wanna have a diagram with the following table Apple 30 40 50 Pears 200 300 400 Bananas 10 20 30 The weird thing, when I try to draw a bar diagram the order of the bars change. So Excel draws me first the Bananas, the the pears and finally the apple bar... Is there anyway to tell Excel 2003 that it keeps the order? Thank you very much

    Read the article

  • Manager/Container class vs static class methods

    - by Ben
    Suppose I a have a Widget class that is part of a framework used independently by many applications. I create Widget instances in many situations and their lifetimes vary. In addition to Widget's instance specified methods, I would like to be able to perform the follow class wide operations: Find a single Widget instance based on a unique id Iterate over the list of all Widgets Remove a widget from the set of all widgets In order support these operations, I have been considering two approaches: Container class - Create some container or manager class, WidgetContainer, which holds a list of all Widget instances, support iteration and provides methods for Widget addition, removal and lookup. For example in C#: public class WidgetContainer : IEnumerable<Widget { public void AddWidget(Widget); public Widget GetWidget(WidgetId id); public void RemoveWidget(WidgetId id); } Static class methods - Add static class methods to Widget. For example: public class Widget { public Widget(WidgetId id); public static Widget GetWidget(WidgetId id); public static void RemoveWidget(WidgetId id); public static IEnumerable<Widget AllWidgets(); } Using a container class has the added problem of how to access the container class. Make it a singleton?..yuck! Create some World object that provides access to all such container classes? I have seen many frameworks that use the container class approach, so what is the general consensus?

    Read the article

  • class inheretence of a attribute which is itself a class

    - by alex
    i have a class which inherets a attribute from a super-class. this attribute is a class itself. class classA(superClass): def func(self,x): if self.attributeB is None: do somthing and in the other class i have class superClass: self.attributB = classB() i get the error AttributeError: class classA has no attribute 'attributeB' when i access the attribute like i showed but if on command line i can see it works, x = classA() x.attributeB is None True so the test works. whats going on in the above code?

    Read the article

  • Using a database class in my user class

    - by Josh
    In my project I have a database class that I use to handle all the MySQL stuff. It connects to a database, runs queries, catches errors and closes the connection. Now I need to create a members area on my site, and I was going to build a users class that would handle registration, logging in, password/username changes/resets and logging out. In this users class I need to use MySQL for obvious reasons... which is what my database class was made for. But I'm confused as to how I would use my database class in my users class. Would I want to create a new database object for my user class and then have it close whenever a method in that class is finished? Or do I somehow make a 'global' database class that can be used throughout my entire script (if this is the case I need help with that, no idea what to do there.) Thanks for any feedback you can give me.

    Read the article

  • Using a datanase class in my user class?

    - by Josh
    In my project I have a database class that I use to handle all the MySQL stuff. It connects to a database, runs queries, catches errors and closes the connection. Now I need to create a members area on my site, and I was going to build a users class that would handle registration, logging in, password/username changes/resets and logging out. In this users class I need to use MySQL for obvious reasons... which is what my database class was made for. But I'm confused as to how I would use my database class in my users class. Would I want to create a new database object for my user class and then have it close whenever a method in that class is finished? Or do I somehow make a 'global' database class that can be used throughout my entire script (if this is the case I need help with that, no idea what to do there.) Thanks for any feedback you can give me.

    Read the article

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