473,781 Members | 2,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Interface Programming the basics


// C3DRect supports IDraw and IShapeEdit.
class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FILLTYPE fType);
virtual void Inverse();
virtual void Stretch(int factor);
};

//-----------------------------------

// Here is the global 3D rect.
C3DRect* ptheRect;

// Functions to operate on the 3D rect.
void CreateThe3DRect ();
void DestroyThe3DRec t();

Implementing CreateThe3DRect () and DestroyThe3DRec t() is trivial.
Simply use the new and delete keywords to create and destroy the
object:

// Creation function.
void CreateThe3DRect ()
{
// Create a 3d-rect.
ptheRect = new C3DRect();
}
// Destroy the rectangle.
void DestroyThe3DRec t()
{
// See ya!
delete ptheRect;
//--------------------
// This method returns interfaces to the client.
bool GetInterfaceFro m3DRect(INTERFA CEID iid, void** iFacePtr)
{
if(ptheRect == NULL){
cout << "You forgot to create the 3DRect!" << endl;
return false;
}
if(iid == IDRAW){ // They want access to IDraw.
// Cast the client's pointer to the IDraw interface of
ptheRect.
*iFacePtr = (IDraw*) ptheRect;
return true;
}
if(iid == ISHAPEEDIT) { // They want access to IShapeEdit.
// Cast the client's pointer to the IShapeEdit interface of
ptheRect.
*iFacePtr = (IShapeEdit*) ptheRect;
return true;
}
// I have no clue what they want.
*iFacePtr = NULL; // Just to be safe.
cout << "C3DRect does not support interface ID: " << iid <<
endl<< endl;
return false;
}
//----------------------------------------------------
int main()
{
bool retVal = false;
IDraw* pDraw = NULL;
//IDraw3* pDraw3 = NULL;
IShapeEdit* pShapeEdit = NULL;

CreateThe3DRect ();

// Can I get the IDraw interface from object?
retVal = GetInterfaceFro m3DRect(IDRAW, (void**)&pDraw) ;
if(retVal)
pDraw->Draw();
DestroyThe3DRec t();

return 0;
}
//-----

help me understand this please.
are we simply casting pointers from one type to the next here?
when selecting the interface with GetInterfaceFro m3DRect ,i have
iFacePtr which is a void pointer and ptheRect.

*iFacePtr = (IDraw*) ptheRect; <-- i dont get this part.
here iFacePtr is of IDraw type.. now we have ptheRect which is of
C3DRect, taking that casting it to IDraw and assigning it to iFacePtr.

does this mean we are working with an instance of C3DRect but of type
IDraw?
how did we managed that?
doesn't this mean we can make an instance of an abstract class by type
casting it?
As you can see im confused any easy to digest explanation would be
great.

thank you

Aug 31 '07 #1
8 1998
On 2007-08-31 18:05, Lamefif wrote:
// C3DRect supports IDraw and IShapeEdit.
class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FILLTYPE fType);
virtual void Inverse();
virtual void Stretch(int factor);
};

//-----------------------------------

// Here is the global 3D rect.
C3DRect* ptheRect;

// Functions to operate on the 3D rect.
void CreateThe3DRect ();
void DestroyThe3DRec t();

Implementing CreateThe3DRect () and DestroyThe3DRec t() is trivial.
Simply use the new and delete keywords to create and destroy the
object:

// Creation function.
void CreateThe3DRect ()
{
// Create a 3d-rect.
ptheRect = new C3DRect();
}
// Destroy the rectangle.
void DestroyThe3DRec t()
{
// See ya!
delete ptheRect;
//--------------------
// This method returns interfaces to the client.
bool GetInterfaceFro m3DRect(INTERFA CEID iid, void** iFacePtr)
{
if(ptheRect == NULL){
cout << "You forgot to create the 3DRect!" << endl;
return false;
}
if(iid == IDRAW){ // They want access to IDraw.
// Cast the client's pointer to the IDraw interface of
ptheRect.
*iFacePtr = (IDraw*) ptheRect;
return true;
}
if(iid == ISHAPEEDIT) { // They want access to IShapeEdit.
// Cast the client's pointer to the IShapeEdit interface of
ptheRect.
*iFacePtr = (IShapeEdit*) ptheRect;
return true;
}
// I have no clue what they want.
*iFacePtr = NULL; // Just to be safe.
cout << "C3DRect does not support interface ID: " << iid <<
endl<< endl;
return false;
}
Really stupid function, could be implemented much easier and cleaner
with something like this:

IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;
}

IShapeEdit* getIShapeEdit() {
return dynamic_cast<IS hapeEdit*>(pthe Rect);
}

And let the user check if the returned pointer is NULL.
//----------------------------------------------------
int main()
{
bool retVal = false;
IDraw* pDraw = NULL;
//IDraw3* pDraw3 = NULL;
IShapeEdit* pShapeEdit = NULL;

CreateThe3DRect ();

// Can I get the IDraw interface from object?
retVal = GetInterfaceFro m3DRect(IDRAW, (void**)&pDraw) ;
if(retVal)
pDraw->Draw();
DestroyThe3DRec t();

return 0;
}
//-----

help me understand this please.
are we simply casting pointers from one type to the next here?
Yes.
when selecting the interface with GetInterfaceFro m3DRect ,i have
iFacePtr which is a void pointer and ptheRect.

*iFacePtr = (IDraw*) ptheRect; <-- i dont get this part.
Cast the pointer ptheRect to a pointer to an IDraw object. Except that
it is assigned to a pointer to void, so you end up with a void pointer.
here iFacePtr is of IDraw type.. now we have ptheRect which is of
C3DRect, taking that casting it to IDraw and assigning it to iFacePtr.

does this mean we are working with an instance of C3DRect but of type
IDraw?
Nope, just pointers.
how did we managed that?
doesn't this mean we can make an instance of an abstract class by type
casting it?
No, we can have pointers (ore references) to objects of an abstract
class, but you can never instantiate an abstract class. That's how
abstract classes can work as interfaces.

--
Erik Wikström
Aug 31 '07 #2
On Aug 31, 6:04 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 18:05, Lamefif wrote:
// C3DRect supports IDraw and IShapeEdit.
class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FILLTYPE fType);
virtual void Inverse();
virtual void Stretch(int factor);
};
//-----------------------------------
// Here is the global 3D rect.
C3DRect* ptheRect;
// Functions to operate on the 3D rect.
void CreateThe3DRect ();
void DestroyThe3DRec t();
Implementing CreateThe3DRect () and DestroyThe3DRec t() is trivial.
Simply use the new and delete keywords to create and destroy the
object:
// Creation function.
void CreateThe3DRect ()
{
// Create a 3d-rect.
ptheRect = new C3DRect();
}
// Destroy the rectangle.
void DestroyThe3DRec t()
{
// See ya!
delete ptheRect;
//--------------------
// This method returns interfaces to the client.
bool GetInterfaceFro m3DRect(INTERFA CEID iid, void** iFacePtr)
{
if(ptheRect == NULL){
cout << "You forgot to create the 3DRect!" << endl;
return false;
}
if(iid == IDRAW){ // They want access to IDraw.
// Cast the client's pointer to the IDraw interface of
ptheRect.
*iFacePtr = (IDraw*) ptheRect;
return true;
}
if(iid == ISHAPEEDIT) { // They want access to IShapeEdit.
// Cast the client's pointer to the IShapeEdit interface of
ptheRect.
*iFacePtr = (IShapeEdit*) ptheRect;
return true;
}
// I have no clue what they want.
*iFacePtr = NULL; // Just to be safe.
cout << "C3DRect does not support interface ID: " << iid <<
endl<< endl;
return false;
}

Really stupid function, could be implemented much easier and cleaner
with something like this:

IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;

}

IShapeEdit* getIShapeEdit() {
return dynamic_cast<IS hapeEdit*>(pthe Rect);

}

And let the user check if the returned pointer is NULL.
//----------------------------------------------------
int main()
{
bool retVal = false;
IDraw* pDraw = NULL;
//IDraw3* pDraw3 = NULL;
IShapeEdit* pShapeEdit = NULL;
CreateThe3DRect ();
// Can I get the IDraw interface from object?
retVal = GetInterfaceFro m3DRect(IDRAW, (void**)&pDraw) ;
if(retVal)
pDraw->Draw();
DestroyThe3DRec t();
return 0;
}
//-----
help me understand this please.
are we simply casting pointers from one type to the next here?

Yes.
when selecting the interface with GetInterfaceFro m3DRect ,i have
iFacePtr which is a void pointer and ptheRect.
*iFacePtr = (IDraw*) ptheRect; <-- i dont get this part.

Cast the pointer ptheRect to a pointer to an IDraw object. Except that
it is assigned to a pointer to void, so you end up with a void pointer.
here iFacePtr is of IDraw type.. now we have ptheRect which is of
C3DRect, taking that casting it to IDraw and assigning it to iFacePtr.
does this mean we are working with an instance of C3DRect but of type
IDraw?

Nope, just pointers.
how did we managed that?
doesn't this mean we can make an instance of an abstract class by type
casting it?

No, we can have pointers (ore references) to objects of an abstract
class, but you can never instantiate an abstract class. That's how
abstract classes can work as interfaces.

--
Erik Wikström
So where is pDraw pointing to, IDraw?
the draw() method of IDraw does not have a body, i mean we are getting
the functionality of the Draw method we have written in C3DRect().

and we are creating one instance of C3DRect with CreateThe3DRect ().

a good book suggestion on the subject or article would be appreciated
thanks

Aug 31 '07 #3
On 2007-08-31 21:42, Lamefif wrote:
On Aug 31, 6:04 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
>On 2007-08-31 18:05, Lamefif wrote:
// C3DRect supports IDraw and IShapeEdit.
class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FILLTYPE fType);
virtual void Inverse();
virtual void Stretch(int factor);
};
//-----------------------------------
// Here is the global 3D rect.
C3DRect* ptheRect;
// Functions to operate on the 3D rect.
void CreateThe3DRect ();
void DestroyThe3DRec t();
Implementing CreateThe3DRect () and DestroyThe3DRec t() is trivial.
Simply use the new and delete keywords to create and destroy the
object:
// Creation function.
void CreateThe3DRect ()
{
// Create a 3d-rect.
ptheRect = new C3DRect();
}
// Destroy the rectangle.
void DestroyThe3DRec t()
{
// See ya!
delete ptheRect;
//--------------------
// This method returns interfaces to the client.
bool GetInterfaceFro m3DRect(INTERFA CEID iid, void** iFacePtr)
{
if(ptheRect == NULL){
cout << "You forgot to create the 3DRect!" << endl;
return false;
}
if(iid == IDRAW){ // They want access to IDraw.
// Cast the client's pointer to the IDraw interface of
ptheRect.
*iFacePtr = (IDraw*) ptheRect;
return true;
}
if(iid == ISHAPEEDIT) { // They want access to IShapeEdit.
// Cast the client's pointer to the IShapeEdit interface of
ptheRect.
*iFacePtr = (IShapeEdit*) ptheRect;
return true;
}
// I have no clue what they want.
*iFacePtr = NULL; // Just to be safe.
cout << "C3DRect does not support interface ID: " << iid <<
endl<< endl;
return false;
}

Really stupid function, could be implemented much easier and cleaner
with something like this:

IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;

}

IShapeEdit* getIShapeEdit() {
return dynamic_cast<IS hapeEdit*>(pthe Rect);

}

And let the user check if the returned pointer is NULL.
//----------------------------------------------------
int main()
{
bool retVal = false;
IDraw* pDraw = NULL;
//IDraw3* pDraw3 = NULL;
IShapeEdit* pShapeEdit = NULL;
CreateThe3DRect ();
// Can I get the IDraw interface from object?
retVal = GetInterfaceFro m3DRect(IDRAW, (void**)&pDraw) ;
if(retVal)
pDraw->Draw();
DestroyThe3DRec t();
return 0;
}
//-----
help me understand this please.
are we simply casting pointers from one type to the next here?

Yes.
when selecting the interface with GetInterfaceFro m3DRect ,i have
iFacePtr which is a void pointer and ptheRect.
*iFacePtr = (IDraw*) ptheRect; <-- i dont get this part.

Cast the pointer ptheRect to a pointer to an IDraw object. Except that
it is assigned to a pointer to void, so you end up with a void pointer.
here iFacePtr is of IDraw type.. now we have ptheRect which is of
C3DRect, taking that casting it to IDraw and assigning it to iFacePtr.
does this mean we are working with an instance of C3DRect but of type
IDraw?

Nope, just pointers.
how did we managed that?
doesn't this mean we can make an instance of an abstract class by type
casting it?

No, we can have pointers (ore references) to objects of an abstract
class, but you can never instantiate an abstract class. That's how
abstract classes can work as interfaces.

--
Erik Wikström

So where is pDraw pointing to, IDraw?
pDraw points to the C3DRect instance, same as ptheRect points to.
the draw() method of IDraw does not have a body, i mean we are getting
the functionality of the Draw method we have written in C3DRect().
Yes, since pDraw points to the C3DRect instance.
and we are creating one instance of C3DRect with CreateThe3DRect ().

a good book suggestion on the subject or article would be appreciated
thanks
Any book describing polymorphic behaviour should do. The theory is the
same regardless which language you use. One way to look at it is that
the two pointers (ptheRect and pDraw) are two different interpretations
of the data they point to. ptheRect says that it points to a C3DRect
while pDraw claims to point to a IDraw. We both know that they both
point to a C3DRect, but since it behaves just like a IDraw we can also
treat it like one.

--
Erik Wikström
Aug 31 '07 #4
On Aug 31, 11:10 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 21:42, Lamefif wrote:
On Aug 31, 6:04 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 18:05, Lamefif wrote:
// C3DRect supports IDraw and IShapeEdit.
class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FILLTYPE fType);
virtual void Inverse();
virtual void Stretch(int factor);
};
//-----------------------------------
// Here is the global 3D rect.
C3DRect* ptheRect;
// Functions to operate on the 3D rect.
void CreateThe3DRect ();
void DestroyThe3DRec t();
Implementing CreateThe3DRect () and DestroyThe3DRec t() is trivial.
Simply use the new and delete keywords to create and destroy the
object:
// Creation function.
void CreateThe3DRect ()
{
// Create a 3d-rect.
ptheRect = new C3DRect();
}
// Destroy the rectangle.
void DestroyThe3DRec t()
{
// See ya!
delete ptheRect;
//--------------------
// This method returns interfaces to the client.
bool GetInterfaceFro m3DRect(INTERFA CEID iid, void** iFacePtr)
{
if(ptheRect == NULL){
cout << "You forgot to create the 3DRect!" << endl;
return false;
}
if(iid == IDRAW){ // They want access to IDraw.
// Cast the client's pointer to the IDraw interface of
ptheRect.
*iFacePtr = (IDraw*) ptheRect;
return true;
}
if(iid == ISHAPEEDIT) { // They want access to IShapeEdit.
// Cast the client's pointer to the IShapeEdit interface of
ptheRect.
*iFacePtr = (IShapeEdit*) ptheRect;
return true;
}
// I have no clue what they want.
*iFacePtr = NULL; // Just to be safe.
cout << "C3DRect does not support interface ID: " << iid <<
endl<< endl;
return false;
}
Really stupid function, could be implemented much easier and cleaner
with something like this:
IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;
}
IShapeEdit* getIShapeEdit() {
return dynamic_cast<IS hapeEdit*>(pthe Rect);
}
And let the user check if the returned pointer is NULL.
//----------------------------------------------------
int main()
{
bool retVal = false;
IDraw* pDraw = NULL;
//IDraw3* pDraw3 = NULL;
IShapeEdit* pShapeEdit = NULL;
CreateThe3DRect ();
// Can I get the IDraw interface from object?
retVal = GetInterfaceFro m3DRect(IDRAW, (void**)&pDraw) ;
if(retVal)
pDraw->Draw();
DestroyThe3DRec t();
return 0;
}
//-----
help me understand this please.
are we simply casting pointers from one type to the next here?
Yes.
when selecting the interface with GetInterfaceFro m3DRect ,i have
iFacePtr which is a void pointer and ptheRect.
*iFacePtr = (IDraw*) ptheRect; <-- i dont get this part.
Cast the pointer ptheRect to a pointer to an IDraw object. Except that
it is assigned to a pointer to void, so you end up with a void pointer.
here iFacePtr is of IDraw type.. now we have ptheRect which is of
C3DRect, taking that casting it to IDraw and assigning it to iFacePtr.
does this mean we are working with an instance of C3DRect but of type
IDraw?
Nope, just pointers.
how did we managed that?
doesn't this mean we can make an instance of an abstract class by type
casting it?
No, we can have pointers (ore references) to objects of an abstract
class, but you can never instantiate an abstract class. That's how
abstract classes can work as interfaces.
--
Erik Wikström
So where is pDraw pointing to, IDraw?

pDraw points to the C3DRect instance, same as ptheRect points to.
the draw() method of IDraw does not have a body, i mean we are getting
the functionality of the Draw method we have written in C3DRect().

Yes, since pDraw points to the C3DRect instance.
and we are creating one instance of C3DRect with CreateThe3DRect ().
a good book suggestion on the subject or article would be appreciated
thanks

Any book describing polymorphic behaviour should do. The theory is the
same regardless which language you use. One way to look at it is that
the two pointers (ptheRect and pDraw) are two different interpretations
of the data they point to. ptheRect says that it points to a C3DRect
while pDraw claims to point to a IDraw. We both know that they both
point to a C3DRect, but since it behaves just like a IDraw we can also
treat it like one.

--
Erik Wikström
ok i think i need just a little more pushing in the right direction.

pDraw and ptheRect both point to the same instance.
But treat it differently because they are declared to be of different
type to begin with?

i mean if pDraw points to C3DRect why aren't we seeing the rest of the
methods but only draw(), why are they hidden?

thanks for your replies, i appreciated :)

Sep 1 '07 #5
On 2007-09-01 03:49, Lamefif wrote:
On Aug 31, 11:10 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
>On 2007-08-31 21:42, Lamefif wrote:
On Aug 31, 6:04 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 18:05, Lamefif wrote:
// C3DRect supports IDraw and IShapeEdit.
class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FILLTYPE fType);
virtual void Inverse();
virtual void Stretch(int factor);
};
//-----------------------------------
// Here is the global 3D rect.
C3DRect* ptheRect;
// Functions to operate on the 3D rect.
void CreateThe3DRect ();
void DestroyThe3DRec t();
Implementing CreateThe3DRect () and DestroyThe3DRec t() is trivial.
Simply use the new and delete keywords to create and destroy the
object:
// Creation function.
void CreateThe3DRect ()
{
// Create a 3d-rect.
ptheRect = new C3DRect();
}
// Destroy the rectangle.
void DestroyThe3DRec t()
{
// See ya!
delete ptheRect;
//--------------------
// This method returns interfaces to the client.
bool GetInterfaceFro m3DRect(INTERFA CEID iid, void** iFacePtr)
{
if(ptheRect == NULL){
cout << "You forgot to create the 3DRect!" << endl;
return false;
}
if(iid == IDRAW){ // They want access to IDraw.
// Cast the client's pointer to the IDraw interface of
ptheRect.
*iFacePtr = (IDraw*) ptheRect;
return true;
}
if(iid == ISHAPEEDIT) { // They want access to IShapeEdit.
// Cast the client's pointer to the IShapeEdit interface of
ptheRect.
*iFacePtr = (IShapeEdit*) ptheRect;
return true;
}
// I have no clue what they want.
*iFacePtr = NULL; // Just to be safe.
cout << "C3DRect does not support interface ID: " << iid <<
endl<< endl;
return false;
}
>Really stupid function, could be implemented much easier and cleaner
with something like this:
>IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;
>}
>IShapeEdit* getIShapeEdit() {
return dynamic_cast<IS hapeEdit*>(pthe Rect);
>}
>And let the user check if the returned pointer is NULL.
//----------------------------------------------------
int main()
{
bool retVal = false;
IDraw* pDraw = NULL;
//IDraw3* pDraw3 = NULL;
IShapeEdit* pShapeEdit = NULL;
CreateThe3DRect ();
// Can I get the IDraw interface from object?
retVal = GetInterfaceFro m3DRect(IDRAW, (void**)&pDraw) ;
if(retVal)
pDraw->Draw();
DestroyThe3DRec t();
return 0;
}
//-----
help me understand this please.
are we simply casting pointers from one type to the next here?
>Yes.
when selecting the interface with GetInterfaceFro m3DRect ,i have
iFacePtr which is a void pointer and ptheRect.
*iFacePtr = (IDraw*) ptheRect; <-- i dont get this part.
>Cast the pointer ptheRect to a pointer to an IDraw object. Except that
it is assigned to a pointer to void, so you end up with a void pointer.
here iFacePtr is of IDraw type.. now we have ptheRect which is of
C3DRect, taking that casting it to IDraw and assigning it to iFacePtr.
does this mean we are working with an instance of C3DRect but of type
IDraw?
>Nope, just pointers.
how did we managed that?
doesn't this mean we can make an instance of an abstract class by type
casting it?
>No, we can have pointers (ore references) to objects of an abstract
class, but you can never instantiate an abstract class. That's how
abstract classes can work as interfaces.
>--
Erik Wikström
So where is pDraw pointing to, IDraw?

pDraw points to the C3DRect instance, same as ptheRect points to.
the draw() method of IDraw does not have a body, i mean we are getting
the functionality of the Draw method we have written in C3DRect().

Yes, since pDraw points to the C3DRect instance.
and we are creating one instance of C3DRect with CreateThe3DRect ().
a good book suggestion on the subject or article would be appreciated
thanks

Any book describing polymorphic behaviour should do. The theory is the
same regardless which language you use. One way to look at it is that
the two pointers (ptheRect and pDraw) are two different interpretations
of the data they point to. ptheRect says that it points to a C3DRect
while pDraw claims to point to a IDraw. We both know that they both
point to a C3DRect, but since it behaves just like a IDraw we can also
treat it like one.

--
Erik Wikström

ok i think i need just a little more pushing in the right direction.

pDraw and ptheRect both point to the same instance.
But treat it differently because they are declared to be of different
type to begin with?
Yes.
i mean if pDraw points to C3DRect why aren't we seeing the rest of the
methods but only draw(), why are they hidden?
Because compilers are stupid and trust the programmer. This means that
when we access the data pointed to by ptheRect it will interpret the
data as a C3DRect, and when accessing it through pDraw it will interpret
it as an IDraw.

This is important when IDraw is not an abstract class, since if you then
make a copy of what pDraw points to, only the IDraw portion will be
copied and the rest ignored. This is called slicing and is usually not
what you want.

--
Erik Wikström
Sep 1 '07 #6
On Sep 1, 10:15 am, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-09-01 03:49, Lamefif wrote:
On Aug 31, 11:10 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 21:42, Lamefif wrote:
On Aug 31, 6:04 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 18:05, Lamefif wrote:
// C3DRect supports IDraw and IShapeEdit.
class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FILLTYPE fType);
virtual void Inverse();
virtual void Stretch(int factor);
};
//-----------------------------------
// Here is the global 3D rect.
C3DRect* ptheRect;
// Functions to operate on the 3D rect.
void CreateThe3DRect ();
void DestroyThe3DRec t();
Implementing CreateThe3DRect () and DestroyThe3DRec t() is trivial.
Simply use the new and delete keywords to create and destroy the
object:
// Creation function.
void CreateThe3DRect ()
{
// Create a 3d-rect.
ptheRect = new C3DRect();
}
// Destroy the rectangle.
void DestroyThe3DRec t()
{
// See ya!
delete ptheRect;
//--------------------
// This method returns interfaces to the client.
bool GetInterfaceFro m3DRect(INTERFA CEID iid, void** iFacePtr)
{
if(ptheRect == NULL){
cout << "You forgot to create the 3DRect!" << endl;
return false;
}
if(iid == IDRAW){ // They want access to IDraw.
// Cast the client's pointer to the IDraw interface of
ptheRect.
*iFacePtr = (IDraw*) ptheRect;
return true;
}
if(iid == ISHAPEEDIT) { // They want access to IShapeEdit.
// Cast the client's pointer to the IShapeEdit interface of
ptheRect.
*iFacePtr = (IShapeEdit*) ptheRect;
return true;
}
// I have no clue what they want.
*iFacePtr = NULL; // Just to be safe.
cout << "C3DRect does not support interface ID: " << iid <<
endl<< endl;
return false;
}
Really stupid function, could be implemented much easier and cleaner
with something like this:
IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;
}
IShapeEdit* getIShapeEdit() {
return dynamic_cast<IS hapeEdit*>(pthe Rect);
}
And let the user check if the returned pointer is NULL.
//----------------------------------------------------
int main()
{
bool retVal = false;
IDraw* pDraw = NULL;
//IDraw3* pDraw3 = NULL;
IShapeEdit* pShapeEdit = NULL;
CreateThe3DRect ();
// Can I get the IDraw interface from object?
retVal = GetInterfaceFro m3DRect(IDRAW, (void**)&pDraw) ;
if(retVal)
pDraw->Draw();
DestroyThe3DRec t();
return 0;
}
//-----
help me understand this please.
are we simply casting pointers from one type to the next here?
Yes.
when selecting the interface with GetInterfaceFro m3DRect ,i have
iFacePtr which is a void pointer and ptheRect.
*iFacePtr = (IDraw*) ptheRect; <-- i dont get this part.
Cast the pointer ptheRect to a pointer to an IDraw object. Except that
it is assigned to a pointer to void, so you end up with a void pointer.
here iFacePtr is of IDraw type.. now we have ptheRect which is of
C3DRect, taking that casting it to IDraw and assigning it to iFacePtr.
does this mean we are working with an instance of C3DRect but of type
IDraw?
Nope, just pointers.
how did we managed that?
doesn't this mean we can make an instance of an abstract class bytype
casting it?
No, we can have pointers (ore references) to objects of an abstract
class, but you can never instantiate an abstract class. That's how
abstract classes can work as interfaces.
--
Erik Wikström
So where is pDraw pointing to, IDraw?
pDraw points to the C3DRect instance, same as ptheRect points to.
the draw() method of IDraw does not have a body, i mean we are getting
the functionality of the Draw method we have written in C3DRect().
Yes, since pDraw points to the C3DRect instance.
and we are creating one instance of C3DRect with CreateThe3DRect ().
a good book suggestion on the subject or article would be appreciated
thanks
Any book describing polymorphic behaviour should do. The theory is the
same regardless which language you use. One way to look at it is that
the two pointers (ptheRect and pDraw) are two different interpretations
of the data they point to. ptheRect says that it points to a C3DRect
while pDraw claims to point to a IDraw. We both know that they both
point to a C3DRect, but since it behaves just like a IDraw we can also
treat it like one.
--
Erik Wikström
ok i think i need just a little more pushing in the right direction.
pDraw and ptheRect both point to the same instance.
But treat it differently because they are declared to be of different
type to begin with?

Yes.
i mean if pDraw points to C3DRect why aren't we seeing the rest of the
methods but only draw(), why are they hidden?

Because compilers are stupid and trust the programmer. This means that
when we access the data pointed to by ptheRect it will interpret the
data as a C3DRect, and when accessing it through pDraw it will interpret
it as an IDraw.

This is important when IDraw is not an abstract class, since if you then
make a copy of what pDraw points to, only the IDraw portion will be
copied and the rest ignored. This is called slicing and is usually not
what you want.

--
Erik Wikström
thanks to you im a lot less confused :)

you said earlier that GetInterfaceFro m3DRect is stupid, and should be
replaces with something like:
IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;

}
getIDraw being a method of C3DRect?

this seems to eliminate the need for interface ID's, if is not too
much to ask what other changes would you make.
i like to see how would you go about designing this, it dont matter if
the code is complex or rather i prefer it :)

and how would you go about implementing this in the main method,
something like?

IDraw* pDraw = NULL;

CreateThe3DRect ();

pDraw = ptheRect->getIDraw();
..
..

DestroyThe3DRec t();
Thanks again

Sep 1 '07 #7
On 2007-09-01 14:11, Lamefif wrote:
On Sep 1, 10:15 am, Erik Wikström <Erik-wikst...@telia. comwrote:
>On 2007-09-01 03:49, Lamefif wrote:
On Aug 31, 11:10 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 21:42, Lamefif wrote:
On Aug 31, 6:04 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 18:05, Lamefif wrote:
// C3DRect supports IDraw and IShapeEdit.
class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FILLTYPE fType);
virtual void Inverse();
virtual void Stretch(int factor);
};
//-----------------------------------
// Here is the global 3D rect.
C3DRect* ptheRect;
// Functions to operate on the 3D rect.
void CreateThe3DRect ();
void DestroyThe3DRec t();
Implementing CreateThe3DRect () and DestroyThe3DRec t() is trivial.
Simply use the new and delete keywords to create and destroy the
object:
// Creation function.
void CreateThe3DRect ()
{
// Create a 3d-rect.
ptheRect = new C3DRect();
}
// Destroy the rectangle.
void DestroyThe3DRec t()
{
// See ya!
delete ptheRect;
//--------------------
// This method returns interfaces to the client.
bool GetInterfaceFro m3DRect(INTERFA CEID iid, void** iFacePtr)
{
if(ptheRect == NULL){
cout << "You forgot to create the 3DRect!" << endl;
return false;
}
if(iid == IDRAW){ // They want access to IDraw.
// Cast the client's pointer to the IDraw interface of
ptheRect.
*iFacePtr = (IDraw*) ptheRect;
return true;
}
if(iid == ISHAPEEDIT) { // They want access to IShapeEdit.
// Cast the client's pointer to the IShapeEdit interface of
ptheRect.
*iFacePtr = (IShapeEdit*) ptheRect;
return true;
}
// I have no clue what they want.
*iFacePtr = NULL; // Just to be safe.
cout << "C3DRect does not support interface ID: " << iid <<
endl<< endl;
return false;
}
>Really stupid function, could be implemented much easier and cleaner
with something like this:
>IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;
>}
>IShapeEdit* getIShapeEdit() {
return dynamic_cast<IS hapeEdit*>(pthe Rect);
>}
>And let the user check if the returned pointer is NULL.
//----------------------------------------------------
int main()
{
bool retVal = false;
IDraw* pDraw = NULL;
//IDraw3* pDraw3 = NULL;
IShapeEdit* pShapeEdit = NULL;
CreateThe3DRect ();
// Can I get the IDraw interface from object?
retVal = GetInterfaceFro m3DRect(IDRAW, (void**)&pDraw) ;
if(retVal)
pDraw->Draw();
DestroyThe3DRec t();
return 0;
}
//-----
help me understand this please.
are we simply casting pointers from one type to the next here?
>Yes.
when selecting the interface with GetInterfaceFro m3DRect ,i have
iFacePtr which is a void pointer and ptheRect.
*iFacePtr = (IDraw*) ptheRect; <-- i dont get this part.
>Cast the pointer ptheRect to a pointer to an IDraw object. Except that
it is assigned to a pointer to void, so you end up with a void pointer.
here iFacePtr is of IDraw type.. now we have ptheRect which is of
C3DRect, taking that casting it to IDraw and assigning it to iFacePtr.
does this mean we are working with an instance of C3DRect but of type
IDraw?
>Nope, just pointers.
how did we managed that?
doesn't this mean we can make an instance of an abstract class by type
casting it?
>No, we can have pointers (ore references) to objects of an abstract
class, but you can never instantiate an abstract class. That's how
abstract classes can work as interfaces.
>--
Erik Wikström
So where is pDraw pointing to, IDraw?
>pDraw points to the C3DRect instance, same as ptheRect points to.
the draw() method of IDraw does not have a body, i mean we are getting
the functionality of the Draw method we have written in C3DRect().
>Yes, since pDraw points to the C3DRect instance.
and we are creating one instance of C3DRect with CreateThe3DRect ().
a good book suggestion on the subject or article would be appreciated
thanks
>Any book describing polymorphic behaviour should do. The theory is the
same regardless which language you use. One way to look at it is that
the two pointers (ptheRect and pDraw) are two different interpretations
of the data they point to. ptheRect says that it points to a C3DRect
while pDraw claims to point to a IDraw. We both know that they both
point to a C3DRect, but since it behaves just like a IDraw we can also
treat it like one.
>--
Erik Wikström
ok i think i need just a little more pushing in the right direction.
pDraw and ptheRect both point to the same instance.
But treat it differently because they are declared to be of different
type to begin with?

Yes.
i mean if pDraw points to C3DRect why aren't we seeing the rest of the
methods but only draw(), why are they hidden?

Because compilers are stupid and trust the programmer. This means that
when we access the data pointed to by ptheRect it will interpret the
data as a C3DRect, and when accessing it through pDraw it will interpret
it as an IDraw.

This is important when IDraw is not an abstract class, since if you then
make a copy of what pDraw points to, only the IDraw portion will be
copied and the rest ignored. This is called slicing and is usually not
what you want.

--
Erik Wikström

thanks to you im a lot less confused :)

you said earlier that GetInterfaceFro m3DRect is stupid, and should be
replaces with something like:
IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;

}
getIDraw being a method of C3DRect?

this seems to eliminate the need for interface ID's, if is not too
much to ask what other changes would you make.
i like to see how would you go about designing this, it dont matter if
the code is complex or rather i prefer it :)

and how would you go about implementing this in the main method,
something like?
I'd get rid of the global variable, CreateThe3DRect , DestroyThe3DRec t,
and GetInterfaceFro m3DRect. They don't serve any purpose that I can see.
IDraw* pDraw = NULL;

CreateThe3DRect ();

pDraw = ptheRect->getIDraw();
We don't need a IDraw pointer to call Draw, we can do that from a
C3DRect pointer as well. In fact we don't need any pointers at all since
none of the code makes use of any polymorphic behaviour.
Since I don't know what the code is supposed to do I'd reduce it to the
minimum which should reproduce the same results:

//-----------------------------------

enum FillType { Solid, Dots, Stripes };

class IDraw
{
public:
virtual void Draw() = 0;
};

class IShapeEdit
{
public:
virtual void Fill (FillType fType) = 0;
virtual void Inverse() = 0;
virtual void Stretch(int factor) = 0;
};

//-----------------------------------

class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FillType fType);
virtual void Inverse();
virtual void Stretch(int factor);
};

//-----------------------------------

int main()
{
C3DRect rect;
rect.Draw();
return 0;
}

Notice the "= 0" at end of the function declarations in the interfaces,
this means that the functions are pure virtual and requires the user to
provide an overload in all classes inheriting from it. I use it to
indicate that those classes are pure interfaces with no implementation.

--
Erik Wikström
Sep 1 '07 #8
On Sep 1, 2:14 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-09-01 14:11, Lamefif wrote:
On Sep 1, 10:15 am, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-09-01 03:49, Lamefif wrote:
On Aug 31, 11:10 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 21:42, Lamefif wrote:
On Aug 31, 6:04 pm, Erik Wikström <Erik-wikst...@telia. comwrote:
On 2007-08-31 18:05, Lamefif wrote:
// C3DRect supports IDraw and IShapeEdit.
class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FILLTYPE fType);
virtual void Inverse();
virtual void Stretch(int factor);
};
//-----------------------------------
// Here is the global 3D rect.
C3DRect* ptheRect;
// Functions to operate on the 3D rect.
void CreateThe3DRect ();
void DestroyThe3DRec t();
Implementing CreateThe3DRect () and DestroyThe3DRec t() is trivial.
Simply use the new and delete keywords to create and destroy the
object:
// Creation function.
void CreateThe3DRect ()
{
// Create a 3d-rect.
ptheRect = new C3DRect();
}
// Destroy the rectangle.
void DestroyThe3DRec t()
{
// See ya!
delete ptheRect;
//--------------------
// This method returns interfaces to the client.
bool GetInterfaceFro m3DRect(INTERFA CEID iid, void** iFacePtr)
{
if(ptheRect == NULL){
cout << "You forgot to create the 3DRect!" << endl;
return false;
}
if(iid == IDRAW){ // They want access to IDraw.
// Cast the client's pointer to the IDraw interface of
ptheRect.
*iFacePtr = (IDraw*) ptheRect;
return true;
}
if(iid == ISHAPEEDIT) { // They want access to IShapeEdit.
// Cast the client's pointer to the IShapeEdit interface of
ptheRect.
*iFacePtr = (IShapeEdit*) ptheRect;
return true;
}
// I have no clue what they want.
*iFacePtr = NULL; // Just to be safe.
cout << "C3DRect does not support interface ID: " << iid <<
endl<< endl;
return false;
}
Really stupid function, could be implemented much easier and cleaner
with something like this:
IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;
}
IShapeEdit* getIShapeEdit() {
return dynamic_cast<IS hapeEdit*>(pthe Rect);
}
And let the user check if the returned pointer is NULL.
//----------------------------------------------------
int main()
{
bool retVal = false;
IDraw* pDraw = NULL;
//IDraw3* pDraw3 = NULL;
IShapeEdit* pShapeEdit = NULL;
CreateThe3DRect ();
// Can I get the IDraw interface from object?
retVal = GetInterfaceFro m3DRect(IDRAW, (void**)&pDraw) ;
if(retVal)
pDraw->Draw();
DestroyThe3DRec t();
return 0;
}
//-----
help me understand this please.
are we simply casting pointers from one type to the next here?
Yes.
when selecting the interface with GetInterfaceFro m3DRect ,i have
iFacePtr which is a void pointer and ptheRect.
*iFacePtr = (IDraw*) ptheRect; <-- i dont get this part.
Cast the pointer ptheRect to a pointer to an IDraw object. Except that
it is assigned to a pointer to void, so you end up with a void pointer.
here iFacePtr is of IDraw type.. now we have ptheRect which isof
C3DRect, taking that casting it to IDraw and assigning it to iFacePtr.
does this mean we are working with an instance of C3DRect but of type
IDraw?
Nope, just pointers.
how did we managed that?
doesn't this mean we can make an instance of an abstract classby type
casting it?
No, we can have pointers (ore references) to objects of an abstract
class, but you can never instantiate an abstract class. That's how
abstract classes can work as interfaces.
--
Erik Wikström
So where is pDraw pointing to, IDraw?
pDraw points to the C3DRect instance, same as ptheRect points to.
the draw() method of IDraw does not have a body, i mean we are getting
the functionality of the Draw method we have written in C3DRect().
Yes, since pDraw points to the C3DRect instance.
and we are creating one instance of C3DRect with CreateThe3DRect ().
a good book suggestion on the subject or article would be appreciated
thanks
Any book describing polymorphic behaviour should do. The theory is the
same regardless which language you use. One way to look at it is that
the two pointers (ptheRect and pDraw) are two different interpretations
of the data they point to. ptheRect says that it points to a C3DRect
while pDraw claims to point to a IDraw. We both know that they both
point to a C3DRect, but since it behaves just like a IDraw we can also
treat it like one.
--
Erik Wikström
ok i think i need just a little more pushing in the right direction.
pDraw and ptheRect both point to the same instance.
But treat it differently because they are declared to be of different
type to begin with?
Yes.
i mean if pDraw points to C3DRect why aren't we seeing the rest of the
methods but only draw(), why are they hidden?
Because compilers are stupid and trust the programmer. This means that
when we access the data pointed to by ptheRect it will interpret the
data as a C3DRect, and when accessing it through pDraw it will interpret
it as an IDraw.
This is important when IDraw is not an abstract class, since if you then
make a copy of what pDraw points to, only the IDraw portion will be
copied and the rest ignored. This is called slicing and is usually not
what you want.
--
Erik Wikström
thanks to you im a lot less confused :)
you said earlier that GetInterfaceFro m3DRect is stupid, and should be
replaces with something like:
IDraw* getIDraw() {
return dynamic_cast<ID raw*>(ptheRect) ;
}
getIDraw being a method of C3DRect?
this seems to eliminate the need for interface ID's, if is not too
much to ask what other changes would you make.
i like to see how would you go about designing this, it dont matter if
the code is complex or rather i prefer it :)
and how would you go about implementing this in the main method,
something like?

I'd get rid of the global variable, CreateThe3DRect , DestroyThe3DRec t,
and GetInterfaceFro m3DRect. They don't serve any purpose that I can see.
IDraw* pDraw = NULL;
CreateThe3DRect ();
pDraw = ptheRect->getIDraw();

We don't need a IDraw pointer to call Draw, we can do that from a
C3DRect pointer as well. In fact we don't need any pointers at all since
none of the code makes use of any polymorphic behaviour.

Since I don't know what the code is supposed to do I'd reduce it to the
minimum which should reproduce the same results:

//-----------------------------------

enum FillType { Solid, Dots, Stripes };

class IDraw
{
public:
virtual void Draw() = 0;

};

class IShapeEdit
{
public:
virtual void Fill (FillType fType) = 0;
virtual void Inverse() = 0;
virtual void Stretch(int factor) = 0;

};

//-----------------------------------

class C3DRect : public IDraw, public IShapeEdit
{
public:
C3DRect();
virtual ~C3DRect();
// IDraw
virtual void Draw();
// IShapeEdit
virtual void Fill (FillType fType);
virtual void Inverse();
virtual void Stretch(int factor);

};

//-----------------------------------

int main()
{
C3DRect rect;
rect.Draw();
return 0;

}

Notice the "= 0" at end of the function declarations in the interfaces,
this means that the functions are pure virtual and requires the user to
provide an overload in all classes inheriting from it. I use it to
indicate that those classes are pure interfaces with no implementation.

--
Erik Wikström
Thank you, been of great help. The book im reading "Developer' s
Workshop to COM and ATL 3.0", its aim is towards COM programming. This
part was brush up on Interfaces.

Maybe this unnecessary complexity is needed later.

Sep 1 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2431
by: Mark | last post by:
Hello. I am new to programming and Python and was wondering if someone could help get me started. I picked Python to start learning to prgram because of some things I have read about it (easy to learn, object oriented, clear syntax, etc...). Can anyone assist in getting me started with learning to program and Python? Recommended reading material? Online tutorials? Recommended development tools (wxpython, pythonwin, etc...)? I am a...
1
2286
by: manish | last post by:
Hi, I am a fresher in the programming field i.e although I have done programming at the basic level but at professional level I am very new and I am facing many problems. These probllems are not taughtand I am not getting any Refrences to cope with them. ********Setting in VC++ 6.0 I don'know to apply setting for various/different projects. I am not getting basics out of it .Can u pls tell me how to make a good understanding of...
6
2398
by: John Walton | last post by:
Hello, everyone. I just began school, and they already assigned us science fair. Since I'm in 8th grade, I get to do demonstrations for our projects. I'm probably going to demonstrate Python's networking capabilities by writing a simple instant messenger program. I only have a few problems: 1. I know squat about Python network Programming 2. I know nothing about networks
3
2488
by: user | last post by:
Hi all, At the outset, I regret having to post this slightly OT post here. However, I strongly feel that people in this group would be the best to advise me on my predicament. I am working as a QA in an MNC in India, since I graduated in September 2003. I am working in a QA role which requires me to do some Winrunner automation, and modifying/creating a framework in Perl for Automated Regression Testing of some command Line utilities...
42
2908
by: Kevin Spencer | last post by:
Is it just me, or am I really observing a trend away from analysis and probem-solving amongst programmers? Let me be more specific: It seems that every day, in greater numbers, people are coming to these programming newsgroups and asking for ready-made solutions to fairly simple programming problems. They either want someone to write code for them, or point them to a ready-made chunk of software that does what they need to do. Now, I'm...
17
4722
by: CoreyWhite | last post by:
I bought this book years ago, when I was just learning C++. Since then I've gone through every math course offered at my college, taken courses on coding C & thinking in terms how how to make the smallest tightest algorithms to preform specific functions. I've also grown and matured a lot, and am wiser and older. I'm reading through the C+ + Programming Language, Third Edition now, and I can actually understand it. I can understand it...
22
3521
by: amygdala | last post by:
Hi, I'm trying to grasp OOP to build an interface using class objects that lets me access database tables easily. You have probably seen this before, or maybe even built it yourself at some point in time. I have studied some examples I found on the internet, and am now trying to build my own from scratch. I have made a default table class (DB_Table), a default validation class (Validator) which is an object inside DB_Table and my...
8
2082
by: rn5a | last post by:
Suppose I have the following class code: Imports System Imports System.Data Imports System.Data.SqlClient Public Class DBSettings Private sqlCmd As SqlCommand Private sqlConn As SqlConnection Public ConnectionString As String
7
6002
Banfa
by: Banfa | last post by:
Posted by Ganon11 So, you want to learn how to program! Good for you! Programming is a very intruiging and fun activity to pick up, and it's also a great career choice if you like it! Finally, it can be a great brain teaser-type activity, as you challenge yourself with creative and difficult problems! But there's a problem. What I'm typing in right now is English. It's cool, it lets you understand what I'm saying, and we've spoken...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10143
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10076
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5375
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.