我有一个基类,Point其中包含3个要派生为Body属性的变量。我想初始化一个点,并用它来初始化主体对象。这是我到目前为止的内容:
#include <iostream>
using namespace std;
class Point {
public:
double x, y, z;
// default constructor
Point(): x(0), y(0), z(0){
};
// intialization constructor
Point(double x, double y, double z){
x = x;
y = y;
z = z;
}
// copy constructor
Point(const Point &point){
x = point.x;
y = point.y;
z = point.z;
}
void print_point(){
cout << "x = "<< x << " y = " << y << " z = …Run Code Online (Sandbox Code Playgroud) 我在 Postgresql 中有一个日期列和一个时间列。我想将这两列合并成一个时间戳列。例如,我想要
date_col (timestamp)
-----------------------
2021-06-28 00:00:00.000
2021-10-11 00:00:00.000
2021-04-01 00:00:00.000
time_col (varchar)
-----------------------
'01:25:00'
'10:55:00'
'08:25:00'
Run Code Online (Sandbox Code Playgroud)
成为
timestamp_col (timestamp)
-----------------------
2021-06-28 01:25:00
2021-10-11 10:55:00
2021-04-01 08:25:00
Run Code Online (Sandbox Code Playgroud)
这是否可能无需繁琐的操作
make_timestamp(date_part('year', date_col), date_part('month', date_col), date_part('day', date_col), date_part('hour', time_col), date_part('minute', time_col), date_part('second', time_col))
Run Code Online (Sandbox Code Playgroud)