0

I'm trying some code with classes but get these errors:

overloaded member function not found in 'Point'
'Point' : no appropriate default constructor available

#include <iostream>

using namespace std;

class Point
{
public:
	Point(float f_x, float f_y, float f_z);

private:
	float x, y, z;

protected:
};

Point::Point()
{
	cout << "We're in the default constructor" << endl;
}

Point::Point(float f_x, float f_y, float f_z)
{
	cout << "We're in the constructor with arguments" << endl;
}

void main()
{
	Point myLocation;
}

Anyone see where I'm going wrong?

4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by En-Motion
0

You are passing no parameters to the Point class's constructor. It expect 3 floats, during instantiation (Point myLocation). You need to give it three floats.

0

I recognize this code, this is from 3DBuzz's tutorial. :)
You did not declare the default constructor in your class. In other words you do not have declaration for the constructor with no arguments. Watch the 'public section' closely.

0

Cheers lads. Working fine now

I recognize this code, this is from 3DBuzz's tutorial. :)

It is indeed!! Find their tutorials fairly good

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.