Can someone point out the use of object class ? i mean using instances of object class did it allocate all the memory gone for all sub classes ? i.e int float etc. etc
I wish to know some of the cases where we must be in need of Object and some cases where we be in need of void pointer ,thanks
A
void*is a pointer to a space in memory that is not set to any particular type, or more, the pointer can point to any ‘type’ of memory, but that memory it points to will still be andintor amyObject.Whilst it would be very ‘odd’ to do so, you might have a function such as
This function could be used to zero out all the bits of a block of memory.
I know openGL also has functions that take
void*, usually for buffers, it means you can create a buffer as eitherchar*orint*for example, and openGL will be fine with it, as long as you tell it how many BYTES this buffer is.of course, both these examples are more C then C++, especially that openGL reference.
As to what you mean by, ‘object class instances’ I have no idea. Perhaps you mean and instance of a class, which you would call and object? In which case, it sound likes you need to learn the fundamentals of OOP
EDIT
‘Object Class Instance’
ok, so you mean a base class.
If you look at Java, all objects are derived from a class Object (not the use of upper case), this base class is implicitly (ie with out you having to do anything) inherited, even by classes that inherit from something else, thus breaking the notion that C# does not support multiple inheritance.
now, the question is about C++, so I simple say that you (more or less) never want to have a base class Object class for all your objects, there is no need. That being said, you might have a base class that a lot of your class are all derived from.
This is a basic concept behind OOP, so if you need this explained you really should sit down and read a good book.