(13<<1)
13=1101
then you move all to the left: 11010
but how you know that is '0' or '1'?
cambalinho 142 Practically a Posting Shark
(13<<1)
13=1101
then you move all to the left: 11010
but how you know that is '0' or '1'?
i read several time about Bitwise Right Shift Operator (>>\<<) but i continue without understand them:(
can anyone explain to me?
i don't undertand what will be the next results:(
Half = 25 >> 1;
Half = 25 << 1;
i'm sorry do you forget some includes?
i get several errors like:
"C:\Users\Joaquim\Documents\CodeBlocks\test\properties.h|9|error: 'property' is not a class template"
hello. my name is joaquim. and i'm new here.
thanks for these forum.
the Visual Studio 2010 have 1 way for build properties, in class's. but isn't a portable code:(
i'm using GNU\GCC\G++.
so don't belive that isn't possible do it in C++;)
so anyone can advice me?
i was testing these code, but i get problems with char* and i can't use th string:(
and seems that i can't use the properties in cin and cout.
#include <iostream>
#include <string>
#include <assert.h>
//property class
#define READ_ONLY 1
#define WRITE_ONLY 2
#define READ_WRITE 3
template <typename Container, typename ValueType, int nPropType>
class property
{
public:
property()
{
m_cObject = NULL;
Set = NULL;
Get = NULL;
}
//-- This to set a pointer to the class that contain the
// property --
void setContainer(Container* cObject)
{
m_cObject = cObject;
}
//-- Set the set member function that will change the value --
void setter(void (Container::*pSet)(ValueType value))
{
if((nPropType == WRITE_ONLY) || (nPropType == READ_WRITE))
Set = pSet;
else
Set = NULL;
}
//-- Set the get member function that will retrieve the value --
void getter(ValueType (Container::*pGet)())
{
if((nPropType == READ_ONLY) || (nPropType == READ_WRITE))
Get = pGet;
else
Get = NULL;
}
//-- Overload the '=' sign to set the value using the set
// member --
ValueType operator =(const ValueType& value)
{
assert(m_cObject != NULL);
assert(Set != NULL);
(m_cObject->*Set)(value);
return value;
}
//-- To make possible to cast the property class to the
// internal type --
operator ValueType()
{
assert(m_cObject != NULL);
assert(Get != NULL); …