Object oriented callbacks and differences in member vs non-member function pointers


I have great respect for the contributors of this newsgroup and have a question that I can't seem to find an answer for, I need to understand if it there is anything in the C++ standard that prevents or ...
Posted On: Monday 26th of November 2012 12:45:54 AM Total Views:  323
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




share code for 2 different objects

I have 2 classes with near identical function names, the only difference is that one class has some additional member functions. I would like to choose to instantiate/use either one of these classes using a flag (from argument), because the ...
VIEWS ON THIS POST

90

Posted on:

Sunday 11th November 2012
View Replies!

const reference to object returned by value

I'm looking at the differences between: const NonTrivialObject& obj = functionThatReturnsANonTrivialObjectByValue(); and: const NonTrivialObject obj = functionThatReturnsANonTrivialObjectByValue(); My question is, can I expect these two lines to be any different I assumed that the object returned by the function ...
VIEWS ON THIS POST

75

Posted on:

Sunday 11th November 2012
View Replies!

is it possible to make a map of objects?

hello, sorry to bother you with this but i can't seem to figure out why i can't do: struct SD { int from; int to; } sd; std::map ListOfWorkingSchedule;...
VIEWS ON THIS POST

106

Posted on:

Sunday 11th November 2012
View Replies!

Address of an object

Please see the following program. I uses Windows XP/VS2003 as my environment. I have two classes inherited from a base class called Interfaces. I have a class named General in which I have instantiated objects for A and B. I ...
VIEWS ON THIS POST

62

Posted on:

Monday 12th November 2012
View Replies!

non-local static object initialization problems

{ Note: multi-posted to [comp.lang.c++]. -mod } My problem is quite similar to Item 10 of Effective C++ (Scott Meyers): http://www.awprofessional.com/conten...EC/EI10_FR.HTM I have Airplane objects declared in a namespace myNamespace in a file main.cpp, the memPool is initialized correctly. Everything ...
VIEWS ON THIS POST

101

Posted on:

Monday 12th November 2012
View Replies!

sizeof an object that have same base class as member objects.

Note: This problem is related to gcc but after some back and forth in group gnu.gcc.help it seems to have morph into more of a c++ specificiation question, hence the transplanting to this group. The original post at gnu.gcc.help can ...
VIEWS ON THIS POST

70

Posted on:

Sunday 25th November 2012
View Replies!

Problems with objects getting sliced to base class

In the following code example I am trying to create a generic interface for a bunch of objects. Each concrete type is stored in its own container and the a container of pointer's to base is used so I can ...
VIEWS ON THIS POST

95

Posted on:

Sunday 25th November 2012
View Replies!

Problems copying object pointer

I have a function called subscribe which passes a pointer to a 'subscribing' object to a class which will call functions on this object. Here is the function: void CEventSelect::subscribe(CEventSelect* user) { m_subscriber = user m_coll.push_back(user); } I declare this ...
VIEWS ON THIS POST

99

Posted on:

Sunday 25th November 2012
View Replies!

Is it bad to have objects pass themselves to new objects?

My app has a bunch of different data types, and a bunch of different graph types that can draw the data. This is a pretty much a 1:1 mapping -- one graph type for each data type. One way I've ...
VIEWS ON THIS POST

109

Posted on:

Sunday 25th November 2012
View Replies!

Cass object returning a value by name?

Sorry if the subject line is vague. I *think* I've seen discussion in the past of this capability but I'm unable to find it. Essentially I have a context in which at makes sense to have a class object return ...
VIEWS ON THIS POST

86

Posted on:

Sunday 25th November 2012
View Replies!

Re: Problems with + operator, trying to sum multiple objects

david wrote: > first of all I am going to past a several parts of code. > > That is my class for now: > class Aibe { > public: > Aibe(); // veikia > Aibe(int arr[], int length); ...
VIEWS ON THIS POST

104

Posted on:

Sunday 25th November 2012
View Replies!

good code to return const reference to function local object?

, 1. Returning non-const reference to function local object is not correct. But is it correct to return const reference to function local object 2. If in (1), it is correct to return const reference to function local object, ...
VIEWS ON THIS POST

73

Posted on:

Sunday 25th November 2012
View Replies!

derived class pointer to base class object

Hi Everyone, I was just playing around virtual functions and landed up with the following, class Base1 { public: virtual void sample() { printf("base::sample\n"); }; }; class Derived1: public Base1 { public: void sample() { printf("derived::sample\n"); }; }; int main() ...
VIEWS ON THIS POST

73

Posted on:

Sunday 25th November 2012
View Replies!

How to apply `sizeof' to `base class subobject'?

The standard says: Base class subobjects may have zero size. (1.8.5) and The result of applying sizeof to a base class subobject is the size of the base class type. (5.3.3.2) But I'm failed to find a way applying `sizeof' ...
VIEWS ON THIS POST

74

Posted on:

Sunday 25th November 2012
View Replies!

Lifetime of member variables in C++ object

Class A { }...
VIEWS ON THIS POST

88

Posted on:

Sunday 25th November 2012
View Replies!

Global objects...

barcaroller wrote: > What is the proper way to instantiate a global object that is visible to > all > modules in a project Look up the "singleton pattern" for C++. If you write this... Global aGlobal; ....then code in ...
VIEWS ON THIS POST

117

Posted on:

Sunday 25th November 2012
View Replies!

function object design problem

Suppose there is some complex functor, and we are using some helper functions inside: class Func { private: inline void helper(...) {...} public: RetType operator()(const &data, Type1 param1, Type2 param2, ...) { const Type1 precomputed_param1 = some_heavy_math(param1, ...); ... ... ...
VIEWS ON THIS POST

92

Posted on:

Sunday 25th November 2012
View Replies!

const reference to object returned by value

I'm looking at the differences between: const NonTrivialObject& obj = functionThatReturnsANonTrivialObjectByValue(); and: const NonTrivialObject obj = functionThatReturnsANonTrivialObjectByValue(); My question is, can I expect these two lines to be any different I assumed that the object returned by the function ...
VIEWS ON THIS POST

70

Posted on:

Sunday 25th November 2012
View Replies!

Re-usable singleton class that can construct pointers to objects with non-trivial constructors

As the topic says, I wanted to make a re-usable singleton class that could create pointers to objects with non-trivial constructors. I came up with this: #ifndef SINGLETON_HPP #define SINGLETON_HPP template struct DefaultCreatorFunctor { T * operator()() const { ...
VIEWS ON THIS POST

158

Posted on:

Sunday 25th November 2012
View Replies!

How to use objectiented programming.

I have been writing some large programs and games lately and I have had people advise me that I need to write more object oriented programs. I also I understand the concept and have written some small programs to understand ...
VIEWS ON THIS POST

124

Posted on:

Monday 26th November 2012
View Replies!