|
You might want to take a closer look at your overloaded constructor.
setZ(double zValue) takes a single parameter of type double. You're not passing in any kind of value (double) when you call setZ in your overloaded constructor.
<code>
Point3D::Point3D(const Point3D& p)
{
setX(p.getX());
setY(p.getY());
setZ(p.setZ());
}
void Point3D::setZ(double zValue)
{
z = zValue;
}
</code>
Regards,
|
|
|
|
|
do I need to do something similiar as below in point2d.cpp
//Point2d.cpp
#include <iostream>
using namespace std;
#include "Point2D.h"
Point2D::Point2D()
{
setX(0);
setY(0);
}
Point2D::Point2D(double a, double b)
{
setX(a);
setY(b);
}
Point2D::Point2D(const Point2D& p)
{
setX( p.getX() );
setY( p.getY() );
}
Point2D Point2D::getPoint() const
{
return (*this);
}
double Point2D::getX() const
{
return x;
}
double Point2D::getY() const
{
return y;
}
void Point2D::setX(double a)
{
x = a;
}
void Point2D::setY(double b)
{
y = b;
}
void Point2D::setPoint(const Point2D& p)
{
setX( p.getX());
setY( p.getY());
}
Point2D Point2D::operator+(const Point2D& p)
{
return Point2D( getX()+p.getX(), getY()+p.getY());
}
Point2D Point2D::operator-(const Point2D& p)
{
return Point2D( getX()-p.getX(), getY()-p.getY());
}
bool Point2D::operator<(const Point2D& p) const
{
return (getX() < p.getX() || getY() < p.getY());
}
bool Point2D::operator>(const Point2D& p) const
{
return (getX() > p.getX() || getY() > p.getY());
}
bool Point2D::operator==(const Point2D& p) const
{
return (getX() == p.getX() && getY() == p.getY());
}
Point2D& Point2D::operator++(void)
{
setX(getX()+1);
setY(getY()+1);
return *this;
}
Point2D Point2D::operator++(int dummy)
{
Point2D p = *this;
setX(getX()+1);
setY(getY()+1);
return p;
}
ostream& operator<<( ostream& o, const Point2D& p)
{
o << "(" << p.getX() << ", " << p.getY() << ")";
return o;
}
Thanks
|
|
|
|
|
In the copy constructor:
Point3D::Point3D(const Point3D& p)<br />
{<br />
setX(p.getX());<br />
setY(p.getY());<br />
setZ(p.setZ());<br />
}<br />
The last line calls p.setZ() when it should call p.getZ() . So the copy constuctor should be:
Point3D::Point3D(const Point3D& p)<br />
{<br />
setX(p.getX());<br />
setY(p.getY());<br />
setZ(p.getZ());<br />
}<br />
|
|
|
|
|
Hello, everyone,
In my current project, I am using BHO. I need a function to be called when the size of IE browser window changes.
In the IDispatch::Invoke function, I tried to use DISPID_WINDOWSETWIDTH, DISPID_WINDOWSETWIDTH and DISPID_WINDOWRESIZE. But none of them fires when the IE browser window size changes?
What should I do?
Thanks a lot in advance.
Bin
|
|
|
|
|
I also tried DISPID_WINDOWSETLEFT, but it doesn't work.
|
|
|
|
|
Mini-Project on "CT Movers"
CT Movers is a small company that specializes in transporting people and moving goods. It has an extensive fleet of vehicles consisting of mini buses, buses and Lorries. Transport services are charged either on an hourly rate or per trip, based on the vehicle capacity.
Write a program that allows the administrator to confirm bookings of vehicles for a particular day. When the program is invoked, the administrator can view the list of vehicles available, and select one for booking. The administrator can then key in the total number of hours or total number of trips, respectively, based on the charge type. The system will then calculate and display the total transport charge, and mark the vehicle as booked and no longer available for the day. The administrator should also be allowed to display the complete list of vehicles in the fleet, their status (booked or available) and the booking details, if booked.
Design and implement a class VehicleInfo in your program. The VehicleInfo class will contain the vehicleID, vehicleType and vehicleCapacity. Two derived classes BusInfo and LorryInfo will inherit from VehicleInfo class. BusInfo will contain vehicleCapacity in terms of number of passengers allowed, and services are charged on an hourly rate. LorryInfo will contain the length, breadth and height of the boxed lorry and services are charged based on the number of trips. You will need to keep track of other data such as the booking status, and the total charges.
The fleet of vehicles available is as follows:
Vehicle Type Capacity Charges Number available
Mini Bus 15 passengers 80 per hour 5
Bus 30 passengers 120 per hour 2
Small Lorry 10'x5'x12' 200 per trip 2
Large Lorry 16'x6'x15' 300 per trip 2
You are required to exercise creativity in your program design and may add other features such as special discounts. You should make your program as friendly as possible to the users
abdul
|
|
|
|
|
Ah, I remember that class, it's called Intro to Object Oriented Programming using C++.
Do you have a specific question? If this is an assignment from a CS course in college the solution is relativly simple. Furthermore, class projects in CS courses generally don't get any easier than this. If someone did give you the complete solution to this problem they wouldn't be doing you any favors.
Try and find a solution to your problem on your own. If you get stuck and have a specific question come back and ask away, I'm sure you'll get alot better reception.
If you just don't know where to start, try contacting your instructor, or re-read your homework assignment.
Good Luck,
|
|
|
|
|
Note: Visual C++ not .net.
How do you load an image from a URL in GDI+?
I have looked at the FromStream function but I don't seem to understand it.
|
|
|
|
|
Is there a way to set the dialog program so that when it run, it read input file (config, ini, txt, data, mdb...). And let say that the file containt an int. if it is 1, the screen will show 1 button, if 2, 2 button and so forth. Also same for string, can the program take in a string and put it up on screen as button label?
thank you!
|
|
|
|
|
You can use INI files or registry to store your settings. Read them on application initialization and apply the settings as per your application's needs. Both INI and registry supports integers and strings.
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|
|
I am writing a application that connect to a server (first time working with sockets) So I have a class calls CCommunication, my include directives (#include <afxsock.h>) and have a pointer to the CSocket declared as private, now I am iplementing the interface, and here is where the problem starts, when I try to use the pointer m_pTheSocket, I get the following error:
error C2065: 'm_pTheSocket' : undeclared identifier
what wrong here?
class communication :publice CSocket
{
...
...
private
CSocket* m_pTheSocket;
};
bool connect()
{
m_pTheSocket->Create()
...
...
}
I get an error????
|
|
|
|
|
connect() is not a method of communication:public CSocket.
Try this
class communication :publice CSocket
{
...
...
private:
CSocket* m_pTheSocket;
public:
bool connect()
{
m_pTheSocket->Create()
...
...
}
};
Also, here is a nice article for you.
http://tangentsoft.net/wskfaq/articles/csocket.html
|
|
|
|
|
|
I have small CHtmlView - based application. If opens a page with Java or JavaScript error, the debugger (InterDev) pops up automatically. I believe In MSIE Internet Options / Advances "Disable script debugging" is checked. Is there a way to prevent it from doing so ?
|
|
|
|
|
Can anyone please explain me how to change font in CEdit.
I tried with CWnd::SetFont() but it doesn't work.
|
|
|
|
|
You need to ensure that the font exists for the life of the CEdit control. Suppose you're changing the font in the OnInitDialog() handler for your class:
BOOL MyDialog::OnInitDialog()
{
CFont myFont;
myFont.CreatePointFont(120,"Arial");
myEdit.SetFont(&myFont);
} This won't work, because as soon as the OnInitDialog function exits, the myFont variable is destroyed, which destroys the font and the edit control reverts to using the standard font.
You fix this by making the myFont value a member of the dialog:
class MyDialog : public CDialog
{
CFont myFont;
};
BOOL MyDialog::OnInitDialog()
{
myFont.CreatePointFont(120,"Arial");
myEdit.SetFont(&myFont);
} Since the myFont variable is a member of the dialog class, it exists for as long as the dialog object, and therefore the edit control.
Software Zen: delete this;
|
|
|
|
|
|
I do apologize if this question has been asked a thousand fold but here I go again with it. Is it possible to compile a VC++6.0 project in VC++ .NET? After some looking I'm thinking .NET is a whole new framework and that it I wrote my project in VC++ 6 than it stays as a VC++ 6 unless I rewrite it? Is that a logical assumption or is there a way to convert it over painlessly.
thanks!
|
|
|
|
|
Yes, you can compile your VS6 project just fine in VS.NET. When you open your old project, you'll be asked to convert it into a VS.NET project. A common mistake for people is to think that VS.NET is .NET only, but you can create just normal C++ programs with it, just like in VS6.
Be sure that everything is compatible with VS.NET though. The company I work for uses OmniORB 3.xx for example, and that won't compile with VS.NET. But normally, there shouldn't be any problems.
|
|
|
|
|
VC.Net will convert your 'project' files. Generally if your source code is conservative then it will just compile with the new compiler and libraries. If you've exploited undocumented features of ATL or MFC then you may have to do some tweaking. Similarly if your use of the standard library was somewhat non-standard then VC.Net may complain.
IME it generally works well. Take care to preserve your original files.
Paul
|
|
|
|
|
Thank you very much for the replies. I'm sorry if I am slow on the uptake but I'm simply looking for a little help possibly a lead on how or perhaps what is happening with my project. Basically it is not compiling and it is erroring out on my ADO class.
I tried looking online here and cannot find source that could help me figure out how to solve some of the errors that are coming up.
For example. the following line tells me adExecuteNoRecords is undeclared. I used MSDN and discovered this enumtype doesn't exist but replaced it what I found on MSDN and I still get this error. Any ideas about it?
m_pConnection->Execute(_bstr_t(lpstrExec), &vRecords, adExecuteNoRecords);<br />
Another is this where it says GetString is undeclared. I haven't a clue what I am supposted to use then.
<br />
varOutput = m_pRecordset->GetString(adClipString, numRows, varCols, varRows, varNull);<br />
The same here where Save is not defined.
<br />
hr = m_pRecordset->Save(lpstrXMLFile, adPersistXML);<br />
Basically I'm a touch worried. These compiled fine under VC++ unless .NET added these lines. I can't see why it would do that. Basically, can anyone lend a hand and help me to where I could go to get some answers on things to look for or perhaps the ADO libraries changed for .NET or perhaps there is something here completely over my head.
Thanks for the tip on .NET though. It helps in that I don't have to worry about going back and forth between vc6 and vcNET.
|
|
|
|
|
Your problem isn't VC.Net, it's ADO.
You have to find where in your source code the ADO stuff is declared, I suppose this could be either via a #include or a #import and work from there.
Paul
|
|
|
|
|
hi all,
have a question which i couldnt find an answer after searching for several days now.
Well everyone knows the "show desktop" button. what i need to do is to intercept its action and do soemthing else instead of the minimizetion of windows(or restoring). well from what i have read and found i gather that the icon calls shell.IDispatch4.minimizeall or undominimize all.
Is there any option to intercept it before its doing this shell line? and by that i mean does anyone knows what message its sending ? or any other method of interception u have will be more then welcome .
thanks in advanced,
Barak
|
|
|
|
|
OOPS , first message/question i ever send here , so i'm a noob when it comes to asking here ...
anyways I'm talking on Visual C++ programing enviorment.
sorry for leaving that detail out
|
|
|
|
|
One solution that I've come up with is subclassing. You can subclass the Quick Launch window, which is in actual a toolbar control (i.e. its window class is ToolbarWindow32 ), intercept the windows messages, and do whatever you want to do.
Gurmeet S. Kochar If you believe in God, it's because of the Devil
My CodeProject Articles: HTML Reader C++ Class Library, Numeric Edit Control
|
|
|
|