강의

멘토링

커뮤니티

Inflearn Community Q&A

jjw925's profile image
jjw925

asked

[Code Factory] [Beginner] Flutter 3.0 App Development - Escape Beginner Status Today with 10 Projects!

Dart #3 Functional Programming

37:58 근처 toString이라는 method에 대한 질문입니다.

Written on

·

468

0

print(parsedPeople); 을 했을 때 Instace of 'Person'으로만 나와서 Person class안에 toString이라는 method를 선언했는데요. class안에 method를 선언한 것 만으로 print(parsedPeople); 값이 바뀐게 맞나요?

class에 선언한 method는 다 실행이 되는건가요?

 

flutter클론코딩

Answer 2

1

jjw925님의 프로필 이미지
jjw925
Questioner

그러면 어떻게보면 print함수를 바꿔줬다고 생각해도 되겠네요 감사합니다.

0

codefactory님의 프로필 이미지
codefactory
Instructor

안녕하세요!

print 함수의 역할이 toString() 메서드를 실행하는겁니다.

toString() 메서드는 모든 클래스가 기본으로 소유하는 메서드로 기본 값은 말씀하신 것 처럼 Instace of 'xxx'로 반환되도록 설계 돼있습니다.

감사합니다!

jjw925's profile image
jjw925

asked

Ask a question