- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I currently have an array of bearings with an integer enumerator to tell me what type of bearing they are. I want to use inheritance using subclasses for the bearing types. How can I continue to store an array of these mixed types of bearings?
This code is inteded to define the array someBearings:
type Bearing
real :: contactAngle
end type
type, extends(Bearing) :: BallBearing
real ballDiameter
end type
type, extends(Bearing) :: RollerBearing
real rollerCrownRadius
end type
type BearingPointer
class(Bearing), pointer :: item => null()
end type
type(BearingPointer), allocatable :: someBearings(:)
The code fails on the class component.
This code is inteded to define the array someBearings:
type Bearing
real :: contactAngle
end type
type, extends(Bearing) :: BallBearing
real ballDiameter
end type
type, extends(Bearing) :: RollerBearing
real rollerCrownRadius
end type
type BearingPointer
class(Bearing), pointer :: item => null()
end type
type(BearingPointer), allocatable :: someBearings(:)
The code fails on the class component.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are you using the 11.1 compiler? That's the first to accept CLASS. I compiled your excerpt with 11.1.035 and it compiled ok.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
Are you using the 11.1 compiler? That's the first to accept CLASS. I compiled your excerpt with 11.1.035 and it compiled ok.
Woops, no I was using 11.0. Getting too far ahead for 11.0. I will give 11.1 a try soon.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page