class

C++ runtime knowledge of classes

I have multiple classes that all derive from a base class, now some of the derived classes will not be compiled depending on the platform. I have a class that allows me to return an object of the base class, however now all the names of the derived classes have been hard coded. Is there a way to determine what classes have been compiled...

'Helper' functions in C++

While refactoring some old code I have stripped out a number of public methods that should actually of been statics as they a) don't operate on any member data or call any other member functions and b) because they might prove useful elsewhere. This led me to think about the best way to group 'helper' functions together. The Java/C# wa...

C++ Class design from database schema

I am writing a perl script to parse a mysql database schema and create C++ classes when necessary. My question is a pretty easy one, but us something I haven't really done before and don't know common practice. Any object of any of classes created will need to have "get" methods to popluate this information. So my questions are twofol...

div class vs id

When using divs when is it best to use a class vs id? Is it best to use class, on say font variant or elements within the html? Then use id for the structure/containers? This is something I've always been a little uncertain on, any help would be great. ...

How to add an event to a class

Say I have a class named Frog, it looks like: public class Frog { public int Location { get; set; } public int JumpCount { get; set; } public void OnJump() { JumpCount++; } } I need help with 2 things: I want to create an event named Jump in the class definition. I want to create an instance of t...

C++ Derived Class problems

I am making a game in C++ and am having problems with my derived class. I have a base class called GameScreen which has a vitrual void draw() function with no statements. I also have a derived class called MenuScreen which also has a virtual void draw() function and a derived class from MenuScreen called TestMenu which also has a void ...

List the names of all the classes within a VS2008 project

Is there a quick & dirty way of obtaining a list of all the classes within a Visual Studio 2008 (c#) project? There are quite a lot of them and Im just lazy enough not to want to do it manually. ...

Is there a .NET function to validate a class name?

I am using CodeDom to generate dynamic code based on user values. One of those values controls what the name of the class I'm generating is. I know I could sterilize the name based on language rules about valid class names using regular expressions, but I'd like to know if there is a specific method built into the framework to validate a...

What are the differences between struct and class in C++

This question was already asked in the context of C#/.Net. Now I'd like to learn the differences between a struct and a class in (unmanaged) C++. Please discuss the technical differences as well as reasons for choosing one or the other in OO design. I'll start with an obvious difference: If you don't specify public: or private:, memb...

Higher mathematics courses online?

As a college dropout working as a software developer, about the only thing I feel I've missed out on is the lack of higher mathematics ( > Calculus I ). I see loads of online MBA courses, CPA, CS, etc courses. I can't find any pure math courses. I suppose I understand why... these things are geared towards career development, not jus...

In C++ I Cannot Grasp Pointers and Classes

I'm fresh out of college and have been working in C++ for some time now. I understand all the basics of C++ and use them, but I'm having a hard time grasping more advanced topics like pointers and classes. I've read some books and tutorials and I understand the examples in them, but then when I look at some advanced real life examples ...

C# - Can publicly inherited methods be hidden (e.g. made private to derived class)

Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance. e.g. public DerivedClass : BaseClass {} Now I want to develop a method C in DerivedClass that uses A and B. Is there a way I can override methods A and B to be private in DerivedClass so that only method C is exposed to someone who w...

How many Python classes should I put in one file?

I'm used to the Java model where you can have one public class per file. Python doesn't have this restriction, and I'm wondering what's the best practice for organising classes. ...

C# class separation into a header and a .cs file

Is there a way to separate a C# class into a header that contains the class definition and then an actual .cs file that contains the implementation? I suppose one can do this by creating an interface, but that doesn't seem right. I just want a file where I can just see the class design, and not all the detail. It's easy enough to do i...

How do you declare an object of a class before the class is created in C++?

Is there anyway to declare an object of a class before the class is created in C++? I ask because I am trying to use two classes, the first needs to have an instance of the second class within it, but the second class also contains an instance of the first class. I realize that you may think I might get into an infinite loop, but I act...

When to use a Class in VBA?

When is it appropriate to use a class in Visual Basic for Applications (VBA)? I'm assuming the accelerated development and reduction of introducing bugs is a common benefit for most languages that support OOP. But with VBA, is there a specific criterion? ...

How does versioning work with Flex remote objects and AMF?

Suppose I use the [RemoteClass] tag to endow a custom Flex class with serialization intelligence. What happens when I need to change my object (add a new field, remove a field, rename a field, etc)? Is there a design pattern for handling this in an elegant way? ...

How do I remove code duplication between similar const and non-const member functions?

Let's say I have the following class X where I want to return access to an internal member: class Z { // details }; class X { std::vector<Z> vecZ; public: Z& Z(size_t index) { // ... // massive amounts of code for // validating index Z& ret = vecZ[index]; // even more code for ...

iterate over classes ie. beans for asp.net

Lets say I have a class that stores user information complete with getters and setters, and it is populated with data from an XML file. How would I iterate over all of the instances of that class like you would do with java beans and tag libraries? ...

MVC model design / inheritance

Forgive the vague title, I wasn't sure how to describe it. If you have a generic model "Archive", how do you show different views/forms based on a user selected 'type'? For example, the user creates a new "Archive", then gets the choice of video, book, audio etc. From there they get different forms based on the archive type. Or would ...