added circle class

This commit is contained in:
Alexander Zhirov 2021-06-25 00:30:49 +03:00
parent 407e117689
commit 023dfa6c14
9 changed files with 20 additions and 123 deletions

Binary file not shown.

View File

@ -1,6 +0,0 @@
main.o: ../main.cpp ../exercise_1.hpp ../exercise_2.hpp ../exercise_3.hpp \
../exercise_4.hpp
../exercise_1.hpp:
../exercise_2.hpp:
../exercise_3.hpp:
../exercise_4.hpp:

Binary file not shown.

View File

@ -1,57 +0,0 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
-include ../makefile.init
RM := rm -rf
# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(CC_DEPS)),)
-include $(CC_DEPS)
endif
ifneq ($(strip $(C++_DEPS)),)
-include $(C++_DEPS)
endif
ifneq ($(strip $(C_UPPER_DEPS)),)
-include $(C_UPPER_DEPS)
endif
ifneq ($(strip $(CXX_DEPS)),)
-include $(CXX_DEPS)
endif
ifneq ($(strip $(CPP_DEPS)),)
-include $(CPP_DEPS)
endif
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif
-include ../makefile.defs
# Add inputs and outputs from these tool invocations to the build variables
# All Target
all: lesson_3
# Tool invocations
lesson_3: $(OBJS) $(USER_OBJS)
@echo 'Building target: $@'
@echo 'Invoking: GCC C++ Linker'
g++ -o "lesson_3" $(OBJS) $(USER_OBJS) $(LIBS)
@echo 'Finished building target: $@'
@echo ' '
# Other Targets
clean:
-$(RM) $(CC_DEPS)$(C++_DEPS)$(EXECUTABLES)$(C_UPPER_DEPS)$(CXX_DEPS)$(OBJS)$(CPP_DEPS)$(C_DEPS) lesson_3
-@echo ' '
.PHONY: all clean dependents
-include ../makefile.targets

View File

@ -1,8 +0,0 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
USER_OBJS :=
LIBS :=

View File

@ -1,27 +0,0 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
C_UPPER_SRCS :=
CXX_SRCS :=
C++_SRCS :=
OBJ_SRCS :=
CC_SRCS :=
ASM_SRCS :=
CPP_SRCS :=
C_SRCS :=
O_SRCS :=
S_UPPER_SRCS :=
CC_DEPS :=
C++_DEPS :=
EXECUTABLES :=
C_UPPER_DEPS :=
CXX_DEPS :=
OBJS :=
CPP_DEPS :=
C_DEPS :=
# Every subdirectory with source files must be described here
SUBDIRS := \
. \

View File

@ -1,24 +0,0 @@
################################################################################
# Automatically-generated file. Do not edit!
################################################################################
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../main.cpp
OBJS += \
./main.o
CPP_DEPS += \
./main.d
# Each subdirectory must supply rules for building sources it contributes
%.o: ../%.cpp
@echo 'Building file: $<'
@echo 'Invoking: GCC C++ Compiler'
g++ -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"
@echo 'Finished building: $<'
@echo ' '

View File

@ -19,7 +19,7 @@ class Figure
{ {
public: public:
virtual float area() = 0; virtual float area() = 0;
virtual ~Figure() = 0; virtual ~Figure() { };
}; };
class Parallelogram : public Figure class Parallelogram : public Figure
@ -54,7 +54,19 @@ public:
class Circle : public Figure class Circle : public Figure
{ {
private:
float m_radius;
public:
Circle(float radius) : m_radius(radius) { }
float area()
{
float area = PI * pow(m_radius, 2);
std::cout << "Площадь круга равна " << area << std::endl;
return area;
}
}; };
class Rectangle : public Parallelogram class Rectangle : public Parallelogram

View File

@ -1,4 +1,5 @@
#include <iostream> #include <iostream>
#include <vector>
#include "exercise_1.hpp" #include "exercise_1.hpp"
#include "exercise_2.hpp" #include "exercise_2.hpp"
#include "exercise_3.hpp" #include "exercise_3.hpp"
@ -8,5 +9,11 @@ using namespace std;
int main() int main()
{ {
// Exercise 1
Parallelogram A(15, 9);
// Figure* figures[5];
return 0;
} }